You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Kevin Zhou (JIRA)" <ji...@apache.org> on 2009/03/05 03:17:56 UTC

[jira] Created: (HARMONY-6110) [classlib] [luni] BufferedOutputStream.reset() does not throw IOException after reading the entire stream, differs from RI

[classlib] [luni] BufferedOutputStream.reset() does not throw IOException after reading the entire stream, differs from RI
--------------------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-6110
                 URL: https://issues.apache.org/jira/browse/HARMONY-6110
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
    Affects Versions: 5.0M8
            Reporter: Kevin Zhou
             Fix For: 5.0M9


The given test case [1] is composed with 2 test scenarios.
Scenario 1: When a buffered reader doesn't read the entire stream, both RI and HARMONY can successfully reset the stream. 
Scenario 2: When a buffered reader has read the entire stream, HARMONY can reset the stream while RI will throw IOException [2].

[1] Test Case:
public class BufferedReaderTest extends TestCase {
BufferedReader bufferedReader;
int[] expected = new int[] { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', -1 };
public void test_reset_sceniro1() throws IOException {
bufferedReader.mark(10);
for (int i = 0; i < 11; i++) { assertEquals(expected[i], bufferedReader.read()); }
try { bufferedReader.reset(); fail("should throw IOException"); } catch (IOException e) { // Expected }
for (int i = 0; i < 11; i++) { assertEquals(-1, bufferedReader.read()); }
}

public void test_reset_scenario2() throws IOException {
bufferedReader.mark(10);
for (int i = 0; i < 10; i++) { assertEquals(expected[i], bufferedReader.read()); } }
bufferedReader.reset();
for (int i = 0; i < 11; i++) { assertEquals(expected[i], bufferedReader.read()); }
}
protected void setUp() { bufferedReader = new BufferedReader(new Support_StringReader( "1234567890")); }
protected void tearDown() { bufferedReader = null; }
}

[2] Stack Trace:
java.io.IOException: Mark invalid
at java.io.BufferedReader.reset(BufferedReader.java:485)
at BufferedReaderTest.test_reset_sceniro1(BufferedReader1Test.java:17)


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Created: (HARMONY-6110) [classlib] [luni] BufferedOutputStream.reset() does not throw IOException after reading the entire stream, differs from RI

Posted by Kevin Zhou <zh...@gmail.com>.
Yes.:) I'm not sure whether we need follow here. I suppose that this is
non-bug difference. Does anyone have different comments?

On Thu, Mar 5, 2009 at 3:29 PM, Regis <xu...@gmail.com> wrote:

> Kevin Zhou wrote:
>
>> This is a difference between HARMONY and RI.Should we follow this?
>>
>>  If I understand correctly,
> "Scenario 2: When a buffered reader has read the entire stream, HARMONY can
> reset the stream while RI will throw IOException [2]. "
>
> is test case "test_reset_sceniro1()", right?
>
> And I also noticed that after reset the stream can still be read from
> marked point in test_reset_sceniro1() run with Harmony. It seems a
> enhancement :) maybe someone need to back to marked point when he encounter
> end-of-file.
>
> --
> Best Regards,
> Regis.
>

Re: [jira] Created: (HARMONY-6110) [classlib] [luni] BufferedOutputStream.reset() does not throw IOException after reading the entire stream, differs from RI

Posted by Regis <xu...@gmail.com>.
Kevin Zhou wrote:
> This is a difference between HARMONY and RI.Should we follow this?
> 
If I understand correctly,
"Scenario 2: When a buffered reader has read the entire stream, HARMONY 
can reset the stream while RI will throw IOException [2]. "

is test case "test_reset_sceniro1()", right?

And I also noticed that after reset the stream can still be read from 
marked point in test_reset_sceniro1() run with Harmony. It seems a 
enhancement :) maybe someone need to back to marked point when he 
encounter end-of-file.

-- 
Best Regards,
Regis.

Re: [jira] Created: (HARMONY-6110) [classlib] [luni] BufferedOutputStream.reset() does not throw IOException after reading the entire stream, differs from RI

Posted by Kevin Zhou <zh...@gmail.com>.
This is a difference between HARMONY and RI.Should we follow this?

[jira] Assigned: (HARMONY-6110) [classlib] [luni] BufferedReader.reset() does not throw IOException after reading the entire stream, differs from RI

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-6110?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tim Ellison reassigned HARMONY-6110:
------------------------------------

    Assignee: Tim Ellison

> [classlib] [luni] BufferedReader.reset() does not throw IOException after reading the entire stream, differs from RI
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6110
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6110
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M8
>            Reporter: Kevin Zhou
>            Assignee: Tim Ellison
>             Fix For: 5.0M9
>
>         Attachments: HARMONY-6110.diff
>
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> The given test case [1] is composed with 2 test scenarios.
> Scenario 1: When a buffered reader doesn't read the entire stream, both RI and HARMONY can successfully reset the stream. 
> Scenario 2: When a buffered reader has read the entire stream, HARMONY can reset the stream while RI will throw IOException [2].
> [1] Test Case:
> public class BufferedReaderTest extends TestCase {
> BufferedReader bufferedReader;
> int[] expected = new int[] { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', -1 };
> public void test_reset_sceniro1() throws IOException {
> bufferedReader.mark(10);
> for (int i = 0; i < 11; i++) { assertEquals(expected[i], bufferedReader.read()); }
> try { bufferedReader.reset(); fail("should throw IOException"); } catch (IOException e) { // Expected }
> for (int i = 0; i < 11; i++) { assertEquals(-1, bufferedReader.read()); }
> }
> public void test_reset_scenario2() throws IOException {
> bufferedReader.mark(10);
> for (int i = 0; i < 10; i++) { assertEquals(expected[i], bufferedReader.read()); } }
> bufferedReader.reset();
> for (int i = 0; i < 11; i++) { assertEquals(expected[i], bufferedReader.read()); }
> }
> protected void setUp() { bufferedReader = new BufferedReader(new Support_StringReader( "1234567890")); }
> protected void tearDown() { bufferedReader = null; }
> }
> [2] Stack Trace:
> java.io.IOException: Mark invalid
> at java.io.BufferedReader.reset(BufferedReader.java:485)
> at BufferedReaderTest.test_reset_sceniro1(BufferedReader1Test.java:17)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (HARMONY-6110) [classlib] [luni] BufferedReader.reset() does not throw IOException after reading the entire stream, differs from RI

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-6110?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tim Ellison resolved HARMONY-6110.
----------------------------------

    Resolution: Fixed

Good catch Kevin!

Patch applied to LUNI module at repo revision r765569.

Please check it was applied as you expected.


> [classlib] [luni] BufferedReader.reset() does not throw IOException after reading the entire stream, differs from RI
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6110
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6110
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M8
>            Reporter: Kevin Zhou
>            Assignee: Tim Ellison
>             Fix For: 5.0M9
>
>         Attachments: HARMONY-6110.diff
>
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> The given test case [1] is composed with 2 test scenarios.
> Scenario 1: When a buffered reader doesn't read the entire stream, both RI and HARMONY can successfully reset the stream. 
> Scenario 2: When a buffered reader has read the entire stream, HARMONY can reset the stream while RI will throw IOException [2].
> [1] Test Case:
> public class BufferedReaderTest extends TestCase {
> BufferedReader bufferedReader;
> int[] expected = new int[] { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', -1 };
> public void test_reset_sceniro1() throws IOException {
> bufferedReader.mark(10);
> for (int i = 0; i < 11; i++) { assertEquals(expected[i], bufferedReader.read()); }
> try { bufferedReader.reset(); fail("should throw IOException"); } catch (IOException e) { // Expected }
> for (int i = 0; i < 11; i++) { assertEquals(-1, bufferedReader.read()); }
> }
> public void test_reset_scenario2() throws IOException {
> bufferedReader.mark(10);
> for (int i = 0; i < 10; i++) { assertEquals(expected[i], bufferedReader.read()); } }
> bufferedReader.reset();
> for (int i = 0; i < 11; i++) { assertEquals(expected[i], bufferedReader.read()); }
> }
> protected void setUp() { bufferedReader = new BufferedReader(new Support_StringReader( "1234567890")); }
> protected void tearDown() { bufferedReader = null; }
> }
> [2] Stack Trace:
> java.io.IOException: Mark invalid
> at java.io.BufferedReader.reset(BufferedReader.java:485)
> at BufferedReaderTest.test_reset_sceniro1(BufferedReader1Test.java:17)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-6110) [classlib] [luni] BufferedReader.reset() does not throw IOException after reading the entire stream, differs from RI

Posted by "Kevin Zhou (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-6110?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kevin Zhou updated HARMONY-6110:
--------------------------------

    Attachment: HARMONY-6110.diff

Would you please help to try it?

> [classlib] [luni] BufferedReader.reset() does not throw IOException after reading the entire stream, differs from RI
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6110
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6110
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M8
>            Reporter: Kevin Zhou
>             Fix For: 5.0M9
>
>         Attachments: HARMONY-6110.diff
>
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> The given test case [1] is composed with 2 test scenarios.
> Scenario 1: When a buffered reader doesn't read the entire stream, both RI and HARMONY can successfully reset the stream. 
> Scenario 2: When a buffered reader has read the entire stream, HARMONY can reset the stream while RI will throw IOException [2].
> [1] Test Case:
> public class BufferedReaderTest extends TestCase {
> BufferedReader bufferedReader;
> int[] expected = new int[] { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', -1 };
> public void test_reset_sceniro1() throws IOException {
> bufferedReader.mark(10);
> for (int i = 0; i < 11; i++) { assertEquals(expected[i], bufferedReader.read()); }
> try { bufferedReader.reset(); fail("should throw IOException"); } catch (IOException e) { // Expected }
> for (int i = 0; i < 11; i++) { assertEquals(-1, bufferedReader.read()); }
> }
> public void test_reset_scenario2() throws IOException {
> bufferedReader.mark(10);
> for (int i = 0; i < 10; i++) { assertEquals(expected[i], bufferedReader.read()); } }
> bufferedReader.reset();
> for (int i = 0; i < 11; i++) { assertEquals(expected[i], bufferedReader.read()); }
> }
> protected void setUp() { bufferedReader = new BufferedReader(new Support_StringReader( "1234567890")); }
> protected void tearDown() { bufferedReader = null; }
> }
> [2] Stack Trace:
> java.io.IOException: Mark invalid
> at java.io.BufferedReader.reset(BufferedReader.java:485)
> at BufferedReaderTest.test_reset_sceniro1(BufferedReader1Test.java:17)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (HARMONY-6110) [classlib] [luni] BufferedReader.reset() does not throw IOException after reading the entire stream, differs from RI

Posted by "Kevin Zhou (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-6110?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kevin Zhou closed HARMONY-6110.
-------------------------------


Thanks Tim.

> [classlib] [luni] BufferedReader.reset() does not throw IOException after reading the entire stream, differs from RI
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6110
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6110
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M8
>            Reporter: Kevin Zhou
>            Assignee: Tim Ellison
>             Fix For: 5.0M9
>
>         Attachments: HARMONY-6110.diff
>
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> The given test case [1] is composed with 2 test scenarios.
> Scenario 1: When a buffered reader doesn't read the entire stream, both RI and HARMONY can successfully reset the stream. 
> Scenario 2: When a buffered reader has read the entire stream, HARMONY can reset the stream while RI will throw IOException [2].
> [1] Test Case:
> public class BufferedReaderTest extends TestCase {
> BufferedReader bufferedReader;
> int[] expected = new int[] { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', -1 };
> public void test_reset_sceniro1() throws IOException {
> bufferedReader.mark(10);
> for (int i = 0; i < 11; i++) { assertEquals(expected[i], bufferedReader.read()); }
> try { bufferedReader.reset(); fail("should throw IOException"); } catch (IOException e) { // Expected }
> for (int i = 0; i < 11; i++) { assertEquals(-1, bufferedReader.read()); }
> }
> public void test_reset_scenario2() throws IOException {
> bufferedReader.mark(10);
> for (int i = 0; i < 10; i++) { assertEquals(expected[i], bufferedReader.read()); } }
> bufferedReader.reset();
> for (int i = 0; i < 11; i++) { assertEquals(expected[i], bufferedReader.read()); }
> }
> protected void setUp() { bufferedReader = new BufferedReader(new Support_StringReader( "1234567890")); }
> protected void tearDown() { bufferedReader = null; }
> }
> [2] Stack Trace:
> java.io.IOException: Mark invalid
> at java.io.BufferedReader.reset(BufferedReader.java:485)
> at BufferedReaderTest.test_reset_sceniro1(BufferedReader1Test.java:17)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-6110) [classlib] [luni] BufferedReader.reset() does not throw IOException after reading the entire stream, differs from RI

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-6110?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tim Ellison updated HARMONY-6110:
---------------------------------

    Fix Version/s:     (was: 5.0M9)
                   5.0M10

> [classlib] [luni] BufferedReader.reset() does not throw IOException after reading the entire stream, differs from RI
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6110
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6110
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M8
>            Reporter: Kevin Zhou
>            Assignee: Tim Ellison
>             Fix For: 5.0M10
>
>         Attachments: HARMONY-6110.diff
>
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> The given test case [1] is composed with 2 test scenarios.
> Scenario 1: When a buffered reader doesn't read the entire stream, both RI and HARMONY can successfully reset the stream. 
> Scenario 2: When a buffered reader has read the entire stream, HARMONY can reset the stream while RI will throw IOException [2].
> [1] Test Case:
> public class BufferedReaderTest extends TestCase {
> BufferedReader bufferedReader;
> int[] expected = new int[] { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', -1 };
> public void test_reset_sceniro1() throws IOException {
> bufferedReader.mark(10);
> for (int i = 0; i < 11; i++) { assertEquals(expected[i], bufferedReader.read()); }
> try { bufferedReader.reset(); fail("should throw IOException"); } catch (IOException e) { // Expected }
> for (int i = 0; i < 11; i++) { assertEquals(-1, bufferedReader.read()); }
> }
> public void test_reset_scenario2() throws IOException {
> bufferedReader.mark(10);
> for (int i = 0; i < 10; i++) { assertEquals(expected[i], bufferedReader.read()); } }
> bufferedReader.reset();
> for (int i = 0; i < 11; i++) { assertEquals(expected[i], bufferedReader.read()); }
> }
> protected void setUp() { bufferedReader = new BufferedReader(new Support_StringReader( "1234567890")); }
> protected void tearDown() { bufferedReader = null; }
> }
> [2] Stack Trace:
> java.io.IOException: Mark invalid
> at java.io.BufferedReader.reset(BufferedReader.java:485)
> at BufferedReaderTest.test_reset_sceniro1(BufferedReader1Test.java:17)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-6110) [classlib] [luni] BufferedReader.reset() does not throw IOException after reading the entire stream, differs from RI

Posted by "Kevin Zhou (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-6110?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kevin Zhou updated HARMONY-6110:
--------------------------------

    Summary: [classlib] [luni] BufferedReader.reset() does not throw IOException after reading the entire stream, differs from RI  (was: [classlib] [luni] BufferedOutputStream.reset() does not throw IOException after reading the entire stream, differs from RI)

> [classlib] [luni] BufferedReader.reset() does not throw IOException after reading the entire stream, differs from RI
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6110
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6110
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M8
>            Reporter: Kevin Zhou
>             Fix For: 5.0M9
>
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> The given test case [1] is composed with 2 test scenarios.
> Scenario 1: When a buffered reader doesn't read the entire stream, both RI and HARMONY can successfully reset the stream. 
> Scenario 2: When a buffered reader has read the entire stream, HARMONY can reset the stream while RI will throw IOException [2].
> [1] Test Case:
> public class BufferedReaderTest extends TestCase {
> BufferedReader bufferedReader;
> int[] expected = new int[] { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', -1 };
> public void test_reset_sceniro1() throws IOException {
> bufferedReader.mark(10);
> for (int i = 0; i < 11; i++) { assertEquals(expected[i], bufferedReader.read()); }
> try { bufferedReader.reset(); fail("should throw IOException"); } catch (IOException e) { // Expected }
> for (int i = 0; i < 11; i++) { assertEquals(-1, bufferedReader.read()); }
> }
> public void test_reset_scenario2() throws IOException {
> bufferedReader.mark(10);
> for (int i = 0; i < 10; i++) { assertEquals(expected[i], bufferedReader.read()); } }
> bufferedReader.reset();
> for (int i = 0; i < 11; i++) { assertEquals(expected[i], bufferedReader.read()); }
> }
> protected void setUp() { bufferedReader = new BufferedReader(new Support_StringReader( "1234567890")); }
> protected void tearDown() { bufferedReader = null; }
> }
> [2] Stack Trace:
> java.io.IOException: Mark invalid
> at java.io.BufferedReader.reset(BufferedReader.java:485)
> at BufferedReaderTest.test_reset_sceniro1(BufferedReader1Test.java:17)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.