Allows the text reader to fail cleanly when the user attempts to recover after catching IonException, but recovery is not possible. #709
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:
FasterXML/jackson-dataformats-binary#471
Description of changes:
Sometimes errors conveyed via
IonException
are recoverable, and sometimes they are not. In cases where these exceptions are not recoverable but the user tries anyway (by calling another method on the reader), the reader should fail cleanly by throwing another IonException. Before this fix, the added test failed withAssertionError
here because a save point had been started on a value that was later found to be invalid. The proposed fix clears the current save point if the current value is found to be malformed. This allows the reader to throw another IonException when the invalid character is encountered again during a subsequent request from the user. Note: the diff looks large, but it's just due to the added nesting level. The only change is the addition of the try/catch.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.