Alternate approach to #797: warn-and-skip instead of throw on null input (Fixed #750)#807
Open
sappenin wants to merge 3 commits into
Open
Alternate approach to #797: warn-and-skip instead of throw on null input (Fixed #750)#807sappenin wants to merge 3 commits into
sappenin wants to merge 3 commits into
Conversation
Signed-off-by: David Fuelling <sappenin@gmail.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #807 +/- ##
============================================
+ Coverage 93.51% 93.52% +0.01%
- Complexity 2606 2617 +11
============================================
Files 486 487 +1
Lines 6580 6607 +27
Branches 566 570 +4
============================================
+ Hits 6153 6179 +26
Misses 270 270
- Partials 157 158 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Signed-off-by: David Fuelling <sappenin@gmail.com>
sappenin
commented
Jun 15, 2026
| while (jsonParser.nextToken() != JsonToken.END_ARRAY) { | ||
| AffectedNode node = elementDeserializer.deserialize(jsonParser, ctxt); | ||
| if (node != null) { | ||
| result.add(node); |
Collaborator
Author
There was a problem hiding this comment.
TODO: An else block should warn if node == null
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.
The current code and the approach proposed in #797 both throw on invalid input. This PR takes a different stance: log a warning and skip the offending entry rather than failing hard. The rationale: rippled should never produce a null JSON value, but in practice it doesn't always behave the way Java expects — particularly around null inputs.
Changes:
AffectedNodeDeserializer: when LedgerEntryType is absent from a CreatedNode, ModifiedNode, or DeletedNode payload, the deserializer now warns and skips rather than propagating an exception.
Exception behavior fix: MismatchedInputException is now thrown (instead of NullPointerException) when LedgerEntryType is missing — correcting the existing error type regardless of the null-input path
AffectedNodeDeserializerTest: added unit tests, which were previously absent entirely