Fix NPE when walking a missing node that will have missing properties#1152
Merged
stevehu merged 2 commits intonetworknt:masterfrom Feb 7, 2025
Merged
Fix NPE when walking a missing node that will have missing properties#1152stevehu merged 2 commits intonetworknt:masterfrom
stevehu merged 2 commits intonetworknt:masterfrom
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1152 +/- ##
============================================
- Coverage 78.90% 78.13% -0.77%
- Complexity 1965 2066 +101
============================================
Files 172 201 +29
Lines 6352 6861 +509
Branches 1255 1255
============================================
+ Hits 5012 5361 +349
- Misses 867 1033 +166
+ Partials 473 467 -6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
jkosternl
reviewed
Feb 7, 2025
Contributor
jkosternl
left a comment
There was a problem hiding this comment.
Just 2 minor remarks, to take into consideration. Good job!
stevehu
approved these changes
Feb 7, 2025
Contributor
|
@justin-tay The latest commit is not included in the previous PR which is merged so quickly. Could you please submit another PR to include the test case? Thanks. |
Collaborator
Author
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.
Closes #1151
Fixes the NPE by having
TypeFactory.getValueNodeType((JsonNode node, SchemaValidatorsConfig config)handle the case where anullwas passed in as the node.I had considered if it should be ensured that the node inputs should always be non null and always replace
nullbyMissingNodeinstead. For instance havingPropertiesValidatorset the input asMissingNodeinstead ofnull. But sinceJsonNode.get(String fieldName)returnsnullfor missing nodes I wasn't sure it would be appropriate.