You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Edouard De Oliveira (JIRA)" <ji...@apache.org> on 2008/02/25 15:50:51 UTC
[jira] Created: (DIRMINA-536) TextLineDecoder throws an
IndexOutOfBoundsException
TextLineDecoder throws an IndexOutOfBoundsException
---------------------------------------------------
Key: DIRMINA-536
URL: https://issues.apache.org/jira/browse/DIRMINA-536
Project: MINA
Issue Type: Bug
Affects Versions: 1.1.6, 1.0.9, 2.0.0-M1
Environment: All versions in any environnement
Reporter: Edouard De Oliveira
Adding the following test to the TextLineDecoderTest JUNIT test class will raise the bug.
It's due to an incomplete match being incorrectly rewinded that causes the IndexOutOfBoundsException
public void testSMTPDataBounds() throws Exception {
TextLineDecoder decoder = new TextLineDecoder(Charset.forName("ISO-8859-1"),
new LineDelimiter("\r\n.\r\n"));
CharsetEncoder encoder = Charset.forName("ISO-8859-1").newEncoder();
IoSession session = new DummySession();
TestDecoderOutput out = new TestDecoderOutput();
ByteBuffer in = ByteBuffer.allocate(16).setAutoExpand(true);
in.putString("\r\n", encoder).flip().mark();
decoder.decode(session, in.reset().mark(), out);
Assert.assertEquals(0, out.getMessageQueue().size());
in.putString("Body\r\n.\r\n", encoder).flip().mark();
decoder.decode(session, in.reset().mark(), out);
Assert.assertEquals(1, out.getMessageQueue().size());
}
------
To solve the issue, a simple patch is to replace the following line in org.apache.mina.filter.codec.textline.TextLineDecoder.java :
in.position(in.position()-matchCount);
by
in.position(Math.max(0, in.position()-matchCount));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DIRMINA-536) TextLineDecoder throws an
IndexOutOfBoundsException
Posted by "Mike Heath (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-536?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mike Heath updated DIRMINA-536:
-------------------------------
Fix Version/s: 2.0.0-M2
> TextLineDecoder throws an IndexOutOfBoundsException
> ---------------------------------------------------
>
> Key: DIRMINA-536
> URL: https://issues.apache.org/jira/browse/DIRMINA-536
> Project: MINA
> Issue Type: Bug
> Components: Filter
> Affects Versions: 1.0.9, 1.1.6, 2.0.0-M1
> Environment: All versions in any environnement
> Reporter: Edouard De Oliveira
> Fix For: 2.0.0-M2
>
> Original Estimate: 0.25h
> Remaining Estimate: 0.25h
>
> Adding the following test to the TextLineDecoderTest JUNIT test class will raise the bug.
> It's due to an incomplete match being incorrectly rewinded that causes the IndexOutOfBoundsException
>
> public void testSMTPDataBounds() throws Exception {
> TextLineDecoder decoder = new TextLineDecoder(Charset.forName("ISO-8859-1"),
> new LineDelimiter("\r\n.\r\n"));
> CharsetEncoder encoder = Charset.forName("ISO-8859-1").newEncoder();
> IoSession session = new DummySession();
> TestDecoderOutput out = new TestDecoderOutput();
> ByteBuffer in = ByteBuffer.allocate(16).setAutoExpand(true);
> in.putString("\r\n", encoder).flip().mark();
> decoder.decode(session, in.reset().mark(), out);
> Assert.assertEquals(0, out.getMessageQueue().size());
> in.putString("Body\r\n.\r\n", encoder).flip().mark();
> decoder.decode(session, in.reset().mark(), out);
> Assert.assertEquals(1, out.getMessageQueue().size());
> }
> ------
> To solve the issue, a simple patch is to replace the following line in org.apache.mina.filter.codec.textline.TextLineDecoder.java :
> in.position(in.position()-matchCount);
> by
> in.position(Math.max(0, in.position()-matchCount));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (DIRMINA-536) TextLineDecoder throws an
IndexOutOfBoundsException
Posted by "Edouard De Oliveira (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-536?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Edouard De Oliveira closed DIRMINA-536.
---------------------------------------
Fix ok
> TextLineDecoder throws an IndexOutOfBoundsException
> ---------------------------------------------------
>
> Key: DIRMINA-536
> URL: https://issues.apache.org/jira/browse/DIRMINA-536
> Project: MINA
> Issue Type: Bug
> Components: Filter
> Affects Versions: 1.0.9, 1.1.6, 2.0.0-M1
> Environment: All versions in any environnement
> Reporter: Edouard De Oliveira
> Assignee: Trustin Lee
> Fix For: 1.0.10, 1.1.7, 2.0.0-M2
>
> Original Estimate: 0.25h
> Remaining Estimate: 0.25h
>
> Adding the following test to the TextLineDecoderTest JUNIT test class will raise the bug.
> It's due to an incomplete match being incorrectly rewinded that causes the IndexOutOfBoundsException
>
> public void testSMTPDataBounds() throws Exception {
> TextLineDecoder decoder = new TextLineDecoder(Charset.forName("ISO-8859-1"),
> new LineDelimiter("\r\n.\r\n"));
> CharsetEncoder encoder = Charset.forName("ISO-8859-1").newEncoder();
> IoSession session = new DummySession();
> TestDecoderOutput out = new TestDecoderOutput();
> ByteBuffer in = ByteBuffer.allocate(16).setAutoExpand(true);
> in.putString("\r\n", encoder).flip().mark();
> decoder.decode(session, in.reset().mark(), out);
> Assert.assertEquals(0, out.getMessageQueue().size());
> in.putString("Body\r\n.\r\n", encoder).flip().mark();
> decoder.decode(session, in.reset().mark(), out);
> Assert.assertEquals(1, out.getMessageQueue().size());
> }
> ------
> To solve the issue, a simple patch is to replace the following line in org.apache.mina.filter.codec.textline.TextLineDecoder.java :
> in.position(in.position()-matchCount);
> by
> in.position(Math.max(0, in.position()-matchCount));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (DIRMINA-536) TextLineDecoder throws an
IndexOutOfBoundsException
Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-536?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Trustin Lee resolved DIRMINA-536.
---------------------------------
Resolution: Fixed
Fixed as you suggested. Please close this issue if it resolves your problem.
> TextLineDecoder throws an IndexOutOfBoundsException
> ---------------------------------------------------
>
> Key: DIRMINA-536
> URL: https://issues.apache.org/jira/browse/DIRMINA-536
> Project: MINA
> Issue Type: Bug
> Components: Filter
> Affects Versions: 1.0.9, 1.1.6, 2.0.0-M1
> Environment: All versions in any environnement
> Reporter: Edouard De Oliveira
> Assignee: Trustin Lee
> Fix For: 1.0.10, 1.1.7, 2.0.0-M2
>
> Original Estimate: 0.25h
> Remaining Estimate: 0.25h
>
> Adding the following test to the TextLineDecoderTest JUNIT test class will raise the bug.
> It's due to an incomplete match being incorrectly rewinded that causes the IndexOutOfBoundsException
>
> public void testSMTPDataBounds() throws Exception {
> TextLineDecoder decoder = new TextLineDecoder(Charset.forName("ISO-8859-1"),
> new LineDelimiter("\r\n.\r\n"));
> CharsetEncoder encoder = Charset.forName("ISO-8859-1").newEncoder();
> IoSession session = new DummySession();
> TestDecoderOutput out = new TestDecoderOutput();
> ByteBuffer in = ByteBuffer.allocate(16).setAutoExpand(true);
> in.putString("\r\n", encoder).flip().mark();
> decoder.decode(session, in.reset().mark(), out);
> Assert.assertEquals(0, out.getMessageQueue().size());
> in.putString("Body\r\n.\r\n", encoder).flip().mark();
> decoder.decode(session, in.reset().mark(), out);
> Assert.assertEquals(1, out.getMessageQueue().size());
> }
> ------
> To solve the issue, a simple patch is to replace the following line in org.apache.mina.filter.codec.textline.TextLineDecoder.java :
> in.position(in.position()-matchCount);
> by
> in.position(Math.max(0, in.position()-matchCount));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DIRMINA-536) TextLineDecoder throws an
IndexOutOfBoundsException
Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-536?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12590737#action_12590737 ]
Trustin Lee commented on DIRMINA-536:
-------------------------------------
Yes, 1.x is purely under maintenance mode. I was lazy to backport the test cases to both 1.0 and 1.1. :)
> TextLineDecoder throws an IndexOutOfBoundsException
> ---------------------------------------------------
>
> Key: DIRMINA-536
> URL: https://issues.apache.org/jira/browse/DIRMINA-536
> Project: MINA
> Issue Type: Bug
> Components: Filter
> Affects Versions: 1.0.9, 1.1.6, 2.0.0-M1
> Environment: All versions in any environnement
> Reporter: Edouard De Oliveira
> Assignee: Trustin Lee
> Fix For: 1.0.10, 1.1.7, 2.0.0-M2
>
> Original Estimate: 0.25h
> Remaining Estimate: 0.25h
>
> Adding the following test to the TextLineDecoderTest JUNIT test class will raise the bug.
> It's due to an incomplete match being incorrectly rewinded that causes the IndexOutOfBoundsException
>
> public void testSMTPDataBounds() throws Exception {
> TextLineDecoder decoder = new TextLineDecoder(Charset.forName("ISO-8859-1"),
> new LineDelimiter("\r\n.\r\n"));
> CharsetEncoder encoder = Charset.forName("ISO-8859-1").newEncoder();
> IoSession session = new DummySession();
> TestDecoderOutput out = new TestDecoderOutput();
> ByteBuffer in = ByteBuffer.allocate(16).setAutoExpand(true);
> in.putString("\r\n", encoder).flip().mark();
> decoder.decode(session, in.reset().mark(), out);
> Assert.assertEquals(0, out.getMessageQueue().size());
> in.putString("Body\r\n.\r\n", encoder).flip().mark();
> decoder.decode(session, in.reset().mark(), out);
> Assert.assertEquals(1, out.getMessageQueue().size());
> }
> ------
> To solve the issue, a simple patch is to replace the following line in org.apache.mina.filter.codec.textline.TextLineDecoder.java :
> in.position(in.position()-matchCount);
> by
> in.position(Math.max(0, in.position()-matchCount));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DIRMINA-536) TextLineDecoder throws an
IndexOutOfBoundsException
Posted by "Edouard De Oliveira (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-536?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Edouard De Oliveira updated DIRMINA-536:
----------------------------------------
Component/s: Filter
> TextLineDecoder throws an IndexOutOfBoundsException
> ---------------------------------------------------
>
> Key: DIRMINA-536
> URL: https://issues.apache.org/jira/browse/DIRMINA-536
> Project: MINA
> Issue Type: Bug
> Components: Filter
> Affects Versions: 1.0.9, 1.1.6, 2.0.0-M1
> Environment: All versions in any environnement
> Reporter: Edouard De Oliveira
> Original Estimate: 0.25h
> Remaining Estimate: 0.25h
>
> Adding the following test to the TextLineDecoderTest JUNIT test class will raise the bug.
> It's due to an incomplete match being incorrectly rewinded that causes the IndexOutOfBoundsException
>
> public void testSMTPDataBounds() throws Exception {
> TextLineDecoder decoder = new TextLineDecoder(Charset.forName("ISO-8859-1"),
> new LineDelimiter("\r\n.\r\n"));
> CharsetEncoder encoder = Charset.forName("ISO-8859-1").newEncoder();
> IoSession session = new DummySession();
> TestDecoderOutput out = new TestDecoderOutput();
> ByteBuffer in = ByteBuffer.allocate(16).setAutoExpand(true);
> in.putString("\r\n", encoder).flip().mark();
> decoder.decode(session, in.reset().mark(), out);
> Assert.assertEquals(0, out.getMessageQueue().size());
> in.putString("Body\r\n.\r\n", encoder).flip().mark();
> decoder.decode(session, in.reset().mark(), out);
> Assert.assertEquals(1, out.getMessageQueue().size());
> }
> ------
> To solve the issue, a simple patch is to replace the following line in org.apache.mina.filter.codec.textline.TextLineDecoder.java :
> in.position(in.position()-matchCount);
> by
> in.position(Math.max(0, in.position()-matchCount));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DIRMINA-536) TextLineDecoder throws an
IndexOutOfBoundsException
Posted by "Mark Webb (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-536?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12576484#action_12576484 ]
Mark Webb commented on DIRMINA-536:
-----------------------------------
Where does the class TestDecoderOutput come from?
> TextLineDecoder throws an IndexOutOfBoundsException
> ---------------------------------------------------
>
> Key: DIRMINA-536
> URL: https://issues.apache.org/jira/browse/DIRMINA-536
> Project: MINA
> Issue Type: Bug
> Components: Filter
> Affects Versions: 1.0.9, 1.1.6, 2.0.0-M1
> Environment: All versions in any environnement
> Reporter: Edouard De Oliveira
> Fix For: 2.0.0-M2
>
> Original Estimate: 0.25h
> Remaining Estimate: 0.25h
>
> Adding the following test to the TextLineDecoderTest JUNIT test class will raise the bug.
> It's due to an incomplete match being incorrectly rewinded that causes the IndexOutOfBoundsException
>
> public void testSMTPDataBounds() throws Exception {
> TextLineDecoder decoder = new TextLineDecoder(Charset.forName("ISO-8859-1"),
> new LineDelimiter("\r\n.\r\n"));
> CharsetEncoder encoder = Charset.forName("ISO-8859-1").newEncoder();
> IoSession session = new DummySession();
> TestDecoderOutput out = new TestDecoderOutput();
> ByteBuffer in = ByteBuffer.allocate(16).setAutoExpand(true);
> in.putString("\r\n", encoder).flip().mark();
> decoder.decode(session, in.reset().mark(), out);
> Assert.assertEquals(0, out.getMessageQueue().size());
> in.putString("Body\r\n.\r\n", encoder).flip().mark();
> decoder.decode(session, in.reset().mark(), out);
> Assert.assertEquals(1, out.getMessageQueue().size());
> }
> ------
> To solve the issue, a simple patch is to replace the following line in org.apache.mina.filter.codec.textline.TextLineDecoder.java :
> in.position(in.position()-matchCount);
> by
> in.position(Math.max(0, in.position()-matchCount));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DIRMINA-536) TextLineDecoder throws an
IndexOutOfBoundsException
Posted by "Edouard De Oliveira (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-536?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12588610#action_12588610 ]
Edouard De Oliveira commented on DIRMINA-536:
---------------------------------------------
The fix is working as expected
but it seems that the JUnit test has not been added to org.apache.mina.filter.codec.textline.TextLineDecoderTest in 1.1 branch
Is it intentionnal ?
> TextLineDecoder throws an IndexOutOfBoundsException
> ---------------------------------------------------
>
> Key: DIRMINA-536
> URL: https://issues.apache.org/jira/browse/DIRMINA-536
> Project: MINA
> Issue Type: Bug
> Components: Filter
> Affects Versions: 1.0.9, 1.1.6, 2.0.0-M1
> Environment: All versions in any environnement
> Reporter: Edouard De Oliveira
> Assignee: Trustin Lee
> Fix For: 1.0.10, 1.1.7, 2.0.0-M2
>
> Original Estimate: 0.25h
> Remaining Estimate: 0.25h
>
> Adding the following test to the TextLineDecoderTest JUNIT test class will raise the bug.
> It's due to an incomplete match being incorrectly rewinded that causes the IndexOutOfBoundsException
>
> public void testSMTPDataBounds() throws Exception {
> TextLineDecoder decoder = new TextLineDecoder(Charset.forName("ISO-8859-1"),
> new LineDelimiter("\r\n.\r\n"));
> CharsetEncoder encoder = Charset.forName("ISO-8859-1").newEncoder();
> IoSession session = new DummySession();
> TestDecoderOutput out = new TestDecoderOutput();
> ByteBuffer in = ByteBuffer.allocate(16).setAutoExpand(true);
> in.putString("\r\n", encoder).flip().mark();
> decoder.decode(session, in.reset().mark(), out);
> Assert.assertEquals(0, out.getMessageQueue().size());
> in.putString("Body\r\n.\r\n", encoder).flip().mark();
> decoder.decode(session, in.reset().mark(), out);
> Assert.assertEquals(1, out.getMessageQueue().size());
> }
> ------
> To solve the issue, a simple patch is to replace the following line in org.apache.mina.filter.codec.textline.TextLineDecoder.java :
> in.position(in.position()-matchCount);
> by
> in.position(Math.max(0, in.position()-matchCount));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DIRMINA-536) TextLineDecoder throws an
IndexOutOfBoundsException
Posted by "Edouard De Oliveira (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-536?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12576521#action_12576521 ]
Edouard De Oliveira commented on DIRMINA-536:
---------------------------------------------
It's an internal class of org.apache.mina.filter.codec.textline.TextLineDecoderTest which can be found in the core/src/test directory
of the mina 1.1.6 archive for example.
> TextLineDecoder throws an IndexOutOfBoundsException
> ---------------------------------------------------
>
> Key: DIRMINA-536
> URL: https://issues.apache.org/jira/browse/DIRMINA-536
> Project: MINA
> Issue Type: Bug
> Components: Filter
> Affects Versions: 1.0.9, 1.1.6, 2.0.0-M1
> Environment: All versions in any environnement
> Reporter: Edouard De Oliveira
> Fix For: 2.0.0-M2
>
> Original Estimate: 0.25h
> Remaining Estimate: 0.25h
>
> Adding the following test to the TextLineDecoderTest JUNIT test class will raise the bug.
> It's due to an incomplete match being incorrectly rewinded that causes the IndexOutOfBoundsException
>
> public void testSMTPDataBounds() throws Exception {
> TextLineDecoder decoder = new TextLineDecoder(Charset.forName("ISO-8859-1"),
> new LineDelimiter("\r\n.\r\n"));
> CharsetEncoder encoder = Charset.forName("ISO-8859-1").newEncoder();
> IoSession session = new DummySession();
> TestDecoderOutput out = new TestDecoderOutput();
> ByteBuffer in = ByteBuffer.allocate(16).setAutoExpand(true);
> in.putString("\r\n", encoder).flip().mark();
> decoder.decode(session, in.reset().mark(), out);
> Assert.assertEquals(0, out.getMessageQueue().size());
> in.putString("Body\r\n.\r\n", encoder).flip().mark();
> decoder.decode(session, in.reset().mark(), out);
> Assert.assertEquals(1, out.getMessageQueue().size());
> }
> ------
> To solve the issue, a simple patch is to replace the following line in org.apache.mina.filter.codec.textline.TextLineDecoder.java :
> in.position(in.position()-matchCount);
> by
> in.position(Math.max(0, in.position()-matchCount));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DIRMINA-536) TextLineDecoder throws an
IndexOutOfBoundsException
Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-536?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Trustin Lee updated DIRMINA-536:
--------------------------------
Fix Version/s: 1.1.7
1.0.10
Assignee: Trustin Lee
> TextLineDecoder throws an IndexOutOfBoundsException
> ---------------------------------------------------
>
> Key: DIRMINA-536
> URL: https://issues.apache.org/jira/browse/DIRMINA-536
> Project: MINA
> Issue Type: Bug
> Components: Filter
> Affects Versions: 1.0.9, 1.1.6, 2.0.0-M1
> Environment: All versions in any environnement
> Reporter: Edouard De Oliveira
> Assignee: Trustin Lee
> Fix For: 1.0.10, 1.1.7, 2.0.0-M2
>
> Original Estimate: 0.25h
> Remaining Estimate: 0.25h
>
> Adding the following test to the TextLineDecoderTest JUNIT test class will raise the bug.
> It's due to an incomplete match being incorrectly rewinded that causes the IndexOutOfBoundsException
>
> public void testSMTPDataBounds() throws Exception {
> TextLineDecoder decoder = new TextLineDecoder(Charset.forName("ISO-8859-1"),
> new LineDelimiter("\r\n.\r\n"));
> CharsetEncoder encoder = Charset.forName("ISO-8859-1").newEncoder();
> IoSession session = new DummySession();
> TestDecoderOutput out = new TestDecoderOutput();
> ByteBuffer in = ByteBuffer.allocate(16).setAutoExpand(true);
> in.putString("\r\n", encoder).flip().mark();
> decoder.decode(session, in.reset().mark(), out);
> Assert.assertEquals(0, out.getMessageQueue().size());
> in.putString("Body\r\n.\r\n", encoder).flip().mark();
> decoder.decode(session, in.reset().mark(), out);
> Assert.assertEquals(1, out.getMessageQueue().size());
> }
> ------
> To solve the issue, a simple patch is to replace the following line in org.apache.mina.filter.codec.textline.TextLineDecoder.java :
> in.position(in.position()-matchCount);
> by
> in.position(Math.max(0, in.position()-matchCount));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.