Skip to content

Fixes corner case where strict mode isn't working when JSONTokener's next() and back() are called first - #1074

Open
XIAYM-gh wants to merge 2 commits into
stleary:masterfrom
XIAYM-gh:master
Open

Fixes corner case where strict mode isn't working when JSONTokener's next() and back() are called first#1074
XIAYM-gh wants to merge 2 commits into
stleary:masterfrom
XIAYM-gh:master

Conversation

@XIAYM-gh

@XIAYM-gh XIAYM-gh commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

This PR fixes #944, where strict mode syntax check isn't working when next() and back() are called first.

ctors are modified, but the backward compatibility is kept.
Besides, I've added isAtStart() in JSONTokener, which shouldn't be a compatibility issue :)

All tests had passed. Thanks ahead for reviewing this!

@stleary

stleary commented Sep 3, 2026

Copy link
Copy Markdown
Owner

@XIAYM-gh I will resolve the sonarqube issues separately, you can ignore them

Comment thread src/main/java/org/json/JSONArray.java Outdated
Comment thread src/main/java/org/json/JSONObject.java Outdated
Comment thread src/main/java/org/json/JSONTokener.java Outdated
Comment thread src/test/java/org/json/junit/JSONArrayTest.java
Comment thread src/test/java/org/json/junit/JSONObjectTest.java
@XIAYM-gh

XIAYM-gh commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for noticing! I'll start working on this in a few hours. (it's 5:21 AM in my timezone right now, and probably I will sleep more)

@sonarqubecloud

sonarqubecloud Bot commented Sep 4, 2026

Copy link
Copy Markdown

@XIAYM-gh

XIAYM-gh commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

The problems should be settled now. Please review the new changes.

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.

JSONObject and JSONArray initial flag for tokener may be flawed

2 participants