Skip to content

Commit 9de3005

Browse files
authored
Update JSONArray.java for stleary#1007
fix array content starting with ',' in strict mode
1 parent 9b8eefc commit 9de3005

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/main/java/org/json/JSONArray.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ public JSONArray(JSONTokener x, JSONParserConfiguration jsonParserConfiguration)
105105
if (nextChar == 0) {
106106
// array is unclosed. No ']' found, instead EOF
107107
throw x.syntaxError("Expected a ',' or ']'");
108+
} else if (nextChar==',' && jsonParserConfiguration.isStrictMode()) {
109+
throw x.syntaxError("Array content starts with a ','");
108110
}
109111
if (nextChar != ']') {
110112
x.back();

0 commit comments

Comments
 (0)