Apply corner-case fixes under instruction

This commit is contained in:
XIAYM-gh
2026-09-04 08:09:14 +08:00
parent bcbbc89568
commit 359b43d8df
5 changed files with 100 additions and 20 deletions
+9 -9
View File
@@ -195,8 +195,8 @@ public class JSONObject {
* @param x
* A JSONTokener object containing the source string.
* @throws JSONException
* If there is a syntax error in the source string or a
* duplicated key.
* If there is a syntax error in the source string or a
* duplicated key.
*/
public JSONObject(JSONTokener x) throws JSONException {
this(x, x.getJsonParserConfiguration());
@@ -210,8 +210,8 @@ public class JSONObject {
* @param jsonParserConfiguration
* Variable to pass parser custom configuration for json parsing.
* @throws JSONException
* If there is a syntax error in the source string or a
* duplicated key.
* If there is a syntax error in the source string or a
* duplicated key.
*/
public JSONObject(JSONTokener x, JSONParserConfiguration jsonParserConfiguration) throws JSONException {
this(x, jsonParserConfiguration, x.isAtStart());
@@ -225,20 +225,20 @@ public class JSONObject {
* A JSONTokener object containing the source string.
* @param jsonParserConfiguration
* Variable to pass parser custom configuration for json parsing.
* @param eofRequired
* @param isInitial
* A boolean that determines whether this object is the root.
* @throws JSONException
* If there is a syntax error in the source string or a
* duplicated key.
* If there is a syntax error in the source string or a
* duplicated key.
*/
JSONObject(JSONTokener x, JSONParserConfiguration jsonParserConfiguration, boolean eofRequired) throws JSONException {
JSONObject(JSONTokener x, JSONParserConfiguration jsonParserConfiguration, boolean isInitial) throws JSONException {
this();
if (x.nextClean() != '{') {
throw x.syntaxError("A JSONObject text must begin with '{'");
}
for (;;) {
if (parseJSONObject(x, jsonParserConfiguration, eofRequired)) {
if (parseJSONObject(x, jsonParserConfiguration, isInitial)) {
return;
}
}