Repository navigation
Fix triple-quoted clobs ending across pages - #1188
Merged
Merged
Conversation
When the closing quotes of a clob or field name fall on different pages, marking where its text ends stepped back with the wrong sign and at most one page, so valid input threw. Any page end can split them, and streams returning a few bytes per read split them often. Fixes #1187
tgregg
reviewed
Dec 2, 2026
| * See: https://github.com/amazon-ion/ion-java/issues/1187 | ||
| */ | ||
| @Test | ||
| public void tripleQuotedTextReadsTheSameWhereverPagesEnd() throws IOException { |
Contributor
There was a problem hiding this comment.
Could you split this into several parameterized tests?
Collaborator
Author
There was a problem hiding this comment.
Sure, updated it now
So each input and read size runs as its own case, and a failure names the input and read size instead of stopping the whole test. Addresses review comment on #1188
tgregg
approved these changes
Dec 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available: #1187
Description of changes:
Problem
The text reader throws
IllegalArgumentExceptionon a valid triple-quoted clob or field name when its closing'''fall on different pages: for example{{'''abc'''}}read from a stream that returns 1, 2, 3, 5 or 6 bytes perread(), or a clob whose closing quotes straddle the end of a 32K page.Cause
After the closing quotes,
skip_triple_quoted_stringmarks the end of the text at the first of them withsp.markEnd(-3), which can be on an earlier page.save_point_mark_endmoved to the previous page withgetBufferLimit() - pos_offset, butpos_offsetis negative, so every step back threw. It also stepped back at most one page.Change
save_point_mark_endsteps back a page at a time withgetBufferLimit() + pos_offset, but not before the page where the save point starts.IonReaderTextFastPathsTestread triple-quoted clobs and field names at every bytes-per-read value, and with the closing quotes across the end of a full page.malformedValuesLeaveTheReaderUsablenow also runs its triple-quoted clob with 1-byte reads.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.