Fixes corner case where strict mode isn't working when JSONTokener's next() and back() are called first
This commit is contained in:
@@ -120,6 +120,15 @@ public class JSONTokener {
|
||||
this.jsonParserConfiguration = jsonParserConfiguration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the tokener is currently positioned at the beginning,
|
||||
*
|
||||
* @return true if the current input position is the beginning
|
||||
*/
|
||||
public boolean isAtStart() {
|
||||
return this.index == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Back up one character. This provides a sort of lookahead capability,
|
||||
* so that you can test for a digit or letter before attempting to parse
|
||||
@@ -458,14 +467,14 @@ public class JSONTokener {
|
||||
case '{':
|
||||
this.back();
|
||||
try {
|
||||
return new JSONObject(this, jsonParserConfiguration);
|
||||
return new JSONObject(this, jsonParserConfiguration, false);
|
||||
} catch (StackOverflowError e) {
|
||||
throw new JSONException("JSON Array or Object depth too large to process.", e);
|
||||
}
|
||||
case '[':
|
||||
this.back();
|
||||
try {
|
||||
return new JSONArray(this, jsonParserConfiguration);
|
||||
return new JSONArray(this, jsonParserConfiguration, false);
|
||||
} catch (StackOverflowError e) {
|
||||
throw new JSONException("JSON Array or Object depth too large to process.", e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user