Skip to content

Avoid decoding JSON Pointer tokens twice - #1078

Open
jakezwang wants to merge 1 commit into
stleary:masterfrom
jakezwang:fix/json-pointer-double-unescape
Open

jakezwang wants to merge 1 commit into
stleary:masterfrom
jakezwang:fix/json-pointer-double-unescape

Conversation

@jakezwang

Copy link
Copy Markdown

JSONPointer decodes string tokens in its constructor, then decodes them again during object lookup. For example, /~01 incorrectly selects the / member instead of the literal ~1 member. Builder and token-list pointers also misinterpret literal tokens containing ~0 or ~1.

Use the stored token directly in queryFrom. Add regressions for string and URI-fragment pointers, builders, and token lists with distinct colliding keys. This follows the decoding order in RFC 6901 section 4 and addresses the double-unescaping behavior mentioned in #561.

Validation: the three new tests fail before the fix. The JDK 8 and 21 suites and the JDK 21 strict-mode profile each report 801 tests, zero failures/errors and six existing skips. Package and Javadoc generation pass, as does Java 6 source/target compilation.

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants