Open
Description
The way we use ByteArrayInputStream is:
call enterBlock() ---> call mark() ---> call readInteger() ---> call reset()
after reset() is called, we will call read again, but it will throw EOFException, after review code, i found the reason maybe that we don't reset blockLength after reset() is called, the test code can simulate the bug:
@Test
public void testMarkAndReset() throws Exception {
ByteArrayInputStream in = new ByteArrayInputStream(new byte[] {1, 2, 3, 4});
in.enterBlock(4);
in.mark(4);
in.readInteger(4);
in.reset();
assertEquals(1, in.read());
}
Metadata
Metadata
Assignees
Labels
No labels