(jakarta-jsonp) Port JsonPatch START_ARRAY check from jsr-353 module - #92
Open
pjfanning wants to merge 2 commits into
Open
(jakarta-jsonp) Port JsonPatch START_ARRAY check from jsr-353 module#92pjfanning wants to merge 2 commits into
JsonPatch START_ARRAY check from jsr-353 module#92pjfanning wants to merge 2 commits into
Conversation
Commit 59447f3 ("Fixes wrt [core#1378]") added a START_ARRAY guard plus two tests to the jsr-353 `JsonPatchDeserializer`, but the jakarta-jsonp copy was never updated. Without the guard `_deserializeArray()` reads past the end of the document and switches on the resulting `null` token, so non-Array input fails with a bare NPE instead of `InvalidFormatException`: input jsr-353 jakarta-jsonp "op" InvalidFormatException NullPointerException: ... "t" is null 42 InvalidFormatException NullPointerException Port the guard verbatim and bring over the two tests (plus one for numbers). Also add the `a2q()` helper to `TestBase` for the new test content. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This was referenced Sep 9, 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.
Problem
Commit 59447f3 ("Fixes wrt [core#1378]") added a
START_ARRAYguard — plus two tests — tojsr-353'sJsonPatchDeserializer, but thejakarta-jsonpcopy of the same class was never updated. The two modules have drifted.Without the guard,
_deserializeArray()callsnextToken()past the end of the document and switches on the resultingnulltoken, so non-Array input fails with a bare NPE:JsonPatch"op"InvalidFormatExceptionNullPointerException: Cannot invoke "tools.jackson.core.JsonToken.ordinal()" because "t" is null42InvalidFormatExceptionNullPointerExceptionFix
Port the guard verbatim from the jsr-353 twin, so both modules report the same
InvalidFormatException: JSON patch has to be an array of objects.Tests
Brings over
testObjectDeserializationAndPatchingandtestScalarDeserializationAndPatchingfrom the jsr-353 test, plus one for numeric input. Adds the standarda2q()helper toTestBasefor the new test content.jakarta-jsonpsuite: 26 tests, all green.