Merged
Conversation
added 5 commits
December 14, 2024 10:01
…issing all JSONObject test cases and strict mode sanity check. Might be able to simplify implementation a bit more
…semicolon instead of colon separator in object
…de default is true
stleary
commented
Dec 18, 2024
odl-github
pushed a commit
to opendaylight/netconf
that referenced
this pull request
Aug 7, 2025
With current JSON library we can switch to use JSON parser configuration with strict mode. See: https://github.com/stleary/JSON-java/releases/tag/20241224 stleary/JSON-java#921 Change-Id: Ib689f144a9f28f37e113c550646fe8640257cc79 Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
odl-github
pushed a commit
to opendaylight/netconf
that referenced
this pull request
Sep 18, 2025
With current JSON library we can switch to use JSON parser configuration with strict mode. See: https://github.com/stleary/JSON-java/releases/tag/20241224 stleary/JSON-java#921 Change-Id: Ib689f144a9f28f37e113c550646fe8640257cc79 Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech> (cherry picked from commit e490c19)
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.
What problem does this code solve?
The default JSON-Java library is quite permissive in allowing invalid JSON docs to be parsed successfully. The "strict mode" feature is for users who need the library to enforce valid JSON text.
A few months ago, strict mode was added but it was not fully completed. As a result, the code was backed out temporarily and is now restored, with some updates to complete the implementation.
Strict mode is only available when parsing JSON from a text document.
To enable strict mode, use code like the following:
What exactly is excluded in strict mode:
To test for regressions, update the JSONParserConfiguration class to have strict mode enabled by default. Then build the project and run the unit tests, which should all complete successfully.
Does the code still compile with Java6?
Yes
Risks
Low
Changes to the API?
The original strict mode API has been restored.
Will this require a new release?
No
Should the documentation be updated?
No
Does it break the unit tests?
No. Some tests that used invalid JSON text have been fixed. A few tests that specifically use invalid text are skipped when strict mode is defaulted. (see regression testing discussion above). New unit tests were added.
Was any code refactored in this commit?
The internal implementation of strict mode has been updated.
Review status
APPROVED - by myself
Starting 3-day comment window