You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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());
}
The text was updated successfully, but these errors were encountered:
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:
The text was updated successfully, but these errors were encountered: