Skip to content

Commit

Permalink
refactor-strict-mode: remove unneeded param for parseTokener()
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Leary authored and Sean Leary committed May 27, 2024
1 parent 2896cbd commit 4335997
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/main/java/org/json/JSONArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,14 @@ public JSONArray(JSONTokener jsonTokener, JSONParserConfiguration jsonParserConf
throw this.jsonTokener.syntaxError("A JSONArray text must start with '['");
}

parseTokener(jsonParserConfiguration); // runs recursively
parseTokener(); // runs recursively

}

/**
* This method utilizes a JSONTokener initialized with a string to parse a JSONArray
* @param jsonParserConfiguration
*/
private void parseTokener(JSONParserConfiguration jsonParserConfiguration) {
boolean strictMode = jsonParserConfiguration.isStrictMode();
private void parseTokener() {

char cursor = this.jsonTokener.nextClean();

Expand All @@ -132,7 +130,7 @@ private void parseTokener(JSONParserConfiguration jsonParserConfiguration) {

throwErrorIfEoF();

if(strictMode && cursor == ']'){
if(this.jsonParserConfiguration.isStrictMode() && cursor == ']'){
throw this.jsonTokener.syntaxError(getInvalidCharErrorMsg(cursor));
}

Expand All @@ -142,7 +140,7 @@ private void parseTokener(JSONParserConfiguration jsonParserConfiguration) {

this.jsonTokener.back();

parseTokener(jsonParserConfiguration);
parseTokener();
break;
case ']':
break;
Expand All @@ -151,7 +149,7 @@ private void parseTokener(JSONParserConfiguration jsonParserConfiguration) {
boolean currentCharIsQuote = this.jsonTokener.getPrevious() == '"';

this.myArrayList.add(this.jsonTokener.nextValue(jsonParserConfiguration));
parseTokener(jsonParserConfiguration);
parseTokener();
}
}

Expand Down

0 comments on commit 4335997

Please sign in to comment.