Spac Valentin created DIRMINA-1056:
--------------------------------------

             Summary: IllegalArgumentException when setting max and 
minReadBufferSize > 65536 (default)
                 Key: DIRMINA-1056
                 URL: https://issues.apache.org/jira/browse/DIRMINA-1056
             Project: MINA
          Issue Type: Bug
          Components: Transport
    Affects Versions: 2.0.9
            Reporter: Spac Valentin
            Priority: Trivial


After setting the max and minReadBufferSize to 256k on the acceptor's session 
config, the following error is thrown when a client connects:

{code:borderStyle=solid}
java.lang.IllegalArgumentException: minReadBufferSize: 262144 (expected: 
smaller than 65536)
        at 
org.apache.mina.core.session.AbstractIoSessionConfig.setMinReadBufferSize(AbstractIoSessionConfig.java:110)
        at 
org.apache.mina.core.session.AbstractIoSessionConfig.setAll(AbstractIoSessionConfig.java:60)
        at 
org.apache.mina.transport.socket.nio.NioSocketSession.<init>(NioSocketSession.java:65)
        at 
org.apache.mina.transport.socket.nio.NioSocketAcceptor.accept(NioSocketAcceptor.java:200)
        at 
org.apache.mina.transport.socket.nio.NioSocketAcceptor.accept(NioSocketAcceptor.java:51)
        ...
{code}

These two lines seems to be the problem
{code:title=AbstractIoSessionConfig.java}
 setMinReadBufferSize(config.getMinReadBufferSize());
 setMaxReadBufferSize(config.getMaxReadBufferSize());
{code}

This is due to the fact that there is a check when setting the minReadBuffer 
(it should be > than maxReadBufferSize) but the max isn't set yet so it 
compares it with the default value (64k).

Possible fix: just swap the lines, setting the maxReadBufferSize first.





--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to