harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Ellison (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (HARMONY-6110) [classlib] [luni] BufferedReader.reset() does not throw IOException after reading the entire stream, differs from RI
Date Thu, 16 Apr 2009 10:53:14 GMT

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


Mime
View raw message