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

IllegalArgumentException thrown from ErrorGeneratingFilter

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-M6
    • Fix Version/s: 2.0.0-RC1
    • Component/s: Filter
    • Labels:
      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

            • Assignee:
              elecharny Emmanuel L├ęcharny
              Reporter:
              jscrane Stephen Crane
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: