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
{{ message }}
Repository navigation
Text reader throws IllegalArgumentException on a valid triple-quoted clob read from a stream in small chunks #1187
Reading a valid clob written with a triple-quoted string from an InputStream that returns only a few bytes per read() fails:
InputStreamin = newFilterInputStream(newByteArrayInputStream("{{'''abc'''}}".getBytes(StandardCharsets.UTF_8))) {
@Overridepublicintread(byte[] b, intoff, intlen) throwsIOException {
returnsuper.read(b, off, Math.min(len, 1));
}
};
try (IonReaderreader = IonReaderBuilder.standard().build(in)) {
reader.next();
reader.newBytes(); // IllegalArgumentException: end point [5] must be within 1 page of current [6]
}
With this 13-byte input it fails for 1, 2, 3, 5 and 6 bytes per read and succeeds for 4, 7 and 8. Seen on v1.12.1 and v1.12.2.
java.lang.IllegalArgumentException: end point [5] must be within 1 page of current [6]
at com.amazon.ion.impl.UnifiedSavePointManagerX.end_point_too_far(UnifiedSavePointManagerX.java:272)
at com.amazon.ion.impl.UnifiedSavePointManagerX.save_point_mark_end(UnifiedSavePointManagerX.java:258)
at com.amazon.ion.impl.UnifiedSavePointManagerX$SavePoint.markEnd(UnifiedSavePointManagerX.java:334)
After the closing quotes, the skip calls sp.markEnd(-3) (IonReaderTextRawTokensX.java:2279). save_point_mark_end moves back at most one page (UnifiedSavePointManagerX.java:245-259), and since each refill takes a new page while a value is being saved, three characters back can be more than one page back.
Found while adding tests in #1185, which leave this combination out.
Activity