Uploaded image for project: 'MINA'
  1. MINA
  2. DIRMINA-739

IllegalArgumentException thrown from ErrorGeneratingFilter

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.0-M6
    • 2.0.0-RC1
    • Filter
    • None

    Description

      I've configured an ErrorGeneratingFilter in my tests and am now occasionally seeing the following exception:

      Caused by: java.lang.IllegalArgumentException: n must be positive
      	at java.util.Random.nextInt(Random.java:250)
      	at org.apache.mina.filter.errorgenerating.ErrorGeneratingFilter.manipulateIoBuffer(ErrorGeneratingFilter.java:187)
      	at org.apache.mina.filter.errorgenerating.ErrorGeneratingFilter.messageReceived(ErrorGeneratingFilter.java:118)
      	at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:433)
      

      Obviously buffer.remaining() is returning 0 here.

      How about the following fix?

      if (buffer.remaining() > 0 && changeByteProbability > rng.nextInt(1000)) {
      	// as before
      }
      

      Attachments

        Activity

          People

            elecharny Emmanuel Lécharny
            jscrane Stephen Crane
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: