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:
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