You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Emmanuel Lecharny (JIRA)" <ji...@apache.org> on 2016/11/29 14:07:58 UTC

[jira] [Commented] (DIRMINA-1056) IllegalArgumentException when setting max and minReadBufferSize > 65536 (default)

    [ https://issues.apache.org/jira/browse/DIRMINA-1056?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15705383#comment-15705383 ] 

Emmanuel Lecharny commented on DIRMINA-1056:
--------------------------------------------

That makes sense... Have you tested the code after having exchanged the lines ?

> 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)