You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Sergei Ivanov (JIRA)" <ji...@apache.org> on 2011/05/31 18:20:47 UTC
[jira] [Created] (DIRMINA-836) AbstractIoBuffer.putUnsignedXXX(int
index, xxx value) methods disregard index
AbstractIoBuffer.putUnsignedXXX(int index, xxx value) methods disregard index
-----------------------------------------------------------------------------
Key: DIRMINA-836
URL: https://issues.apache.org/jira/browse/DIRMINA-836
Project: MINA
Issue Type: Bug
Components: Core
Affects Versions: 2.0.3
Reporter: Sergei Ivanov
Relates to DIRMINA-823, where these methods were first introduced.
All the "indexed" putUnsignedXXX() methods disregard the index when writing to the underlying buffer.
For example:
public final IoBuffer putUnsignedInt(int index, byte value) {
autoExpand(index, 4);
buf().putInt( (int)((short)value&0x00ff) );
// --------------- ^^^^ --- should pass 'index' in as the first parameter
return this;
}
The test cases in Mina core, attached to revision 1090588, do not catch this because although they use indexed puts, they use unindexed gets (had they used symmetrical indexed gets, they would have failed). A code snippet that demonstrates the problem is below:
final IoBuffer buffer = IoBuffer.allocate(128);
buffer.putUnsignedInt(10, 0x87654321L);
buffer.putUnsignedInt(20, 0xFFFFFFFFL);
System.out.printf("buffer.getUnsignedInt(0) = 0x%08X\n", buffer.getUnsignedInt(0));
System.out.printf("buffer.getUnsignedInt(4) = 0x%08X\n", buffer.getUnsignedInt(4));
System.out.printf("buffer.getUnsignedInt(10) = 0x%08X\n", buffer.getUnsignedInt(10));
System.out.printf("buffer.getUnsignedInt(20) = 0x%08X\n", buffer.getUnsignedInt(20));
A trivial fix is required, which is to pass 'index' parameter to buf().putInt() or buf().putShort() method call.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (DIRMINA-836)
AbstractIoBuffer.putUnsignedXXX(int index, xxx value) methods disregard
index
Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-836?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13041893#comment-13041893 ]
Emmanuel Lecharny commented on DIRMINA-836:
-------------------------------------------
Rahhh... My bad. Will fix that.
> AbstractIoBuffer.putUnsignedXXX(int index, xxx value) methods disregard index
> -----------------------------------------------------------------------------
>
> Key: DIRMINA-836
> URL: https://issues.apache.org/jira/browse/DIRMINA-836
> Project: MINA
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.0.3
> Reporter: Sergei Ivanov
>
> Relates to DIRMINA-823, where these methods were first introduced.
> All the "indexed" putUnsignedXXX() methods disregard the index when writing to the underlying buffer.
> For example:
> public final IoBuffer putUnsignedInt(int index, byte value) {
> autoExpand(index, 4);
> buf().putInt( (int)((short)value&0x00ff) );
> // --------------- ^^^^ --- should pass 'index' in as the first parameter
> return this;
> }
> The test cases in Mina core, attached to revision 1090588, do not catch this because although they use indexed puts, they use unindexed gets (had they used symmetrical indexed gets, they would have failed). A code snippet that demonstrates the problem is below:
> final IoBuffer buffer = IoBuffer.allocate(128);
> buffer.putUnsignedInt(10, 0x87654321L);
> buffer.putUnsignedInt(20, 0xFFFFFFFFL);
> System.out.printf("buffer.getUnsignedInt(0) = 0x%08X\n", buffer.getUnsignedInt(0));
> System.out.printf("buffer.getUnsignedInt(4) = 0x%08X\n", buffer.getUnsignedInt(4));
> System.out.printf("buffer.getUnsignedInt(10) = 0x%08X\n", buffer.getUnsignedInt(10));
> System.out.printf("buffer.getUnsignedInt(20) = 0x%08X\n", buffer.getUnsignedInt(20));
> A trivial fix is required, which is to pass 'index' parameter to buf().putInt() or buf().putShort() method call.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Assigned] (DIRMINA-836) AbstractIoBuffer.putUnsignedXXX(int
index, xxx value) methods disregard index
Posted by "Julien Vermillard (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-836?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Julien Vermillard reassigned DIRMINA-836:
-----------------------------------------
Assignee: Julien Vermillard
> AbstractIoBuffer.putUnsignedXXX(int index, xxx value) methods disregard index
> -----------------------------------------------------------------------------
>
> Key: DIRMINA-836
> URL: https://issues.apache.org/jira/browse/DIRMINA-836
> Project: MINA
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.0.3
> Reporter: Sergei Ivanov
> Assignee: Julien Vermillard
>
> Relates to DIRMINA-823, where these methods were first introduced.
> All the "indexed" putUnsignedXXX() methods disregard the index when writing to the underlying buffer.
> For example:
> public final IoBuffer putUnsignedInt(int index, byte value) {
> autoExpand(index, 4);
> buf().putInt( (int)((short)value&0x00ff) );
> // --------------- ^^^^ --- should pass 'index' in as the first parameter
> return this;
> }
> The test cases in Mina core, attached to revision 1090588, do not catch this because although they use indexed puts, they use unindexed gets (had they used symmetrical indexed gets, they would have failed). A code snippet that demonstrates the problem is below:
> final IoBuffer buffer = IoBuffer.allocate(128);
> buffer.putUnsignedInt(10, 0x87654321L);
> buffer.putUnsignedInt(20, 0xFFFFFFFFL);
> System.out.printf("buffer.getUnsignedInt(0) = 0x%08X\n", buffer.getUnsignedInt(0));
> System.out.printf("buffer.getUnsignedInt(4) = 0x%08X\n", buffer.getUnsignedInt(4));
> System.out.printf("buffer.getUnsignedInt(10) = 0x%08X\n", buffer.getUnsignedInt(10));
> System.out.printf("buffer.getUnsignedInt(20) = 0x%08X\n", buffer.getUnsignedInt(20));
> A trivial fix is required, which is to pass 'index' parameter to buf().putInt() or buf().putShort() method call.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (DIRMINA-836)
AbstractIoBuffer.putUnsignedXXX(int index, xxx value) methods disregard
index
Posted by "Sergei Ivanov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-836?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13041659#comment-13041659 ]
Sergei Ivanov commented on DIRMINA-836:
---------------------------------------
Also, a minor thing:
putUnsignedInt(long) should append 'L' to the bit mask constant:
buf().putInt( (int)(value&0x00000000ffffffffL) );
> AbstractIoBuffer.putUnsignedXXX(int index, xxx value) methods disregard index
> -----------------------------------------------------------------------------
>
> Key: DIRMINA-836
> URL: https://issues.apache.org/jira/browse/DIRMINA-836
> Project: MINA
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.0.3
> Reporter: Sergei Ivanov
>
> Relates to DIRMINA-823, where these methods were first introduced.
> All the "indexed" putUnsignedXXX() methods disregard the index when writing to the underlying buffer.
> For example:
> public final IoBuffer putUnsignedInt(int index, byte value) {
> autoExpand(index, 4);
> buf().putInt( (int)((short)value&0x00ff) );
> // --------------- ^^^^ --- should pass 'index' in as the first parameter
> return this;
> }
> The test cases in Mina core, attached to revision 1090588, do not catch this because although they use indexed puts, they use unindexed gets (had they used symmetrical indexed gets, they would have failed). A code snippet that demonstrates the problem is below:
> final IoBuffer buffer = IoBuffer.allocate(128);
> buffer.putUnsignedInt(10, 0x87654321L);
> buffer.putUnsignedInt(20, 0xFFFFFFFFL);
> System.out.printf("buffer.getUnsignedInt(0) = 0x%08X\n", buffer.getUnsignedInt(0));
> System.out.printf("buffer.getUnsignedInt(4) = 0x%08X\n", buffer.getUnsignedInt(4));
> System.out.printf("buffer.getUnsignedInt(10) = 0x%08X\n", buffer.getUnsignedInt(10));
> System.out.printf("buffer.getUnsignedInt(20) = 0x%08X\n", buffer.getUnsignedInt(20));
> A trivial fix is required, which is to pass 'index' parameter to buf().putInt() or buf().putShort() method call.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Closed] (DIRMINA-836) AbstractIoBuffer.putUnsignedXXX(int
index, xxx value) methods disregard index
Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-836?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Emmanuel Lecharny closed DIRMINA-836.
-------------------------------------
> AbstractIoBuffer.putUnsignedXXX(int index, xxx value) methods disregard index
> -----------------------------------------------------------------------------
>
> Key: DIRMINA-836
> URL: https://issues.apache.org/jira/browse/DIRMINA-836
> Project: MINA
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.0.3
> Reporter: Sergei Ivanov
> Assignee: Julien Vermillard
> Fix For: 2.0.4
>
>
> Relates to DIRMINA-823, where these methods were first introduced.
> All the "indexed" putUnsignedXXX() methods disregard the index when writing to the underlying buffer.
> For example:
> public final IoBuffer putUnsignedInt(int index, byte value) {
> autoExpand(index, 4);
> buf().putInt( (int)((short)value&0x00ff) );
> // --------------- ^^^^ --- should pass 'index' in as the first parameter
> return this;
> }
> The test cases in Mina core, attached to revision 1090588, do not catch this because although they use indexed puts, they use unindexed gets (had they used symmetrical indexed gets, they would have failed). A code snippet that demonstrates the problem is below:
> final IoBuffer buffer = IoBuffer.allocate(128);
> buffer.putUnsignedInt(10, 0x87654321L);
> buffer.putUnsignedInt(20, 0xFFFFFFFFL);
> System.out.printf("buffer.getUnsignedInt(0) = 0x%08X\n", buffer.getUnsignedInt(0));
> System.out.printf("buffer.getUnsignedInt(4) = 0x%08X\n", buffer.getUnsignedInt(4));
> System.out.printf("buffer.getUnsignedInt(10) = 0x%08X\n", buffer.getUnsignedInt(10));
> System.out.printf("buffer.getUnsignedInt(20) = 0x%08X\n", buffer.getUnsignedInt(20));
> A trivial fix is required, which is to pass 'index' parameter to buf().putInt() or buf().putShort() method call.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (DIRMINA-836) AbstractIoBuffer.putUnsignedXXX(int
index, xxx value) methods disregard index
Posted by "Julien Vermillard (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-836?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Julien Vermillard resolved DIRMINA-836.
---------------------------------------
Resolution: Fixed
Fix Version/s: 2.0.4
> AbstractIoBuffer.putUnsignedXXX(int index, xxx value) methods disregard index
> -----------------------------------------------------------------------------
>
> Key: DIRMINA-836
> URL: https://issues.apache.org/jira/browse/DIRMINA-836
> Project: MINA
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.0.3
> Reporter: Sergei Ivanov
> Assignee: Julien Vermillard
> Fix For: 2.0.4
>
>
> Relates to DIRMINA-823, where these methods were first introduced.
> All the "indexed" putUnsignedXXX() methods disregard the index when writing to the underlying buffer.
> For example:
> public final IoBuffer putUnsignedInt(int index, byte value) {
> autoExpand(index, 4);
> buf().putInt( (int)((short)value&0x00ff) );
> // --------------- ^^^^ --- should pass 'index' in as the first parameter
> return this;
> }
> The test cases in Mina core, attached to revision 1090588, do not catch this because although they use indexed puts, they use unindexed gets (had they used symmetrical indexed gets, they would have failed). A code snippet that demonstrates the problem is below:
> final IoBuffer buffer = IoBuffer.allocate(128);
> buffer.putUnsignedInt(10, 0x87654321L);
> buffer.putUnsignedInt(20, 0xFFFFFFFFL);
> System.out.printf("buffer.getUnsignedInt(0) = 0x%08X\n", buffer.getUnsignedInt(0));
> System.out.printf("buffer.getUnsignedInt(4) = 0x%08X\n", buffer.getUnsignedInt(4));
> System.out.printf("buffer.getUnsignedInt(10) = 0x%08X\n", buffer.getUnsignedInt(10));
> System.out.printf("buffer.getUnsignedInt(20) = 0x%08X\n", buffer.getUnsignedInt(20));
> A trivial fix is required, which is to pass 'index' parameter to buf().putInt() or buf().putShort() method call.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira