harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Zhou (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-6110) [classlib] [luni] BufferedOutputStream.reset() does not throw IOException after reading the entire stream, differs from RI
Date Thu, 05 Mar 2009 02:17:56 GMT
[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.


Mime
View raw message