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 06:53:58 UTC

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

     [ 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.