Skip to content

Commit 05867c4

Browse files
committed
Merge branch 'master' of https://github.com/marilynel/JSON-java
2 parents c6efa08 + aff59d0 commit 05867c4

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-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();

src/main/java/org/json/JSONTokener.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,9 @@ Object nextSimpleValue(char c) {
509509
string = sb.toString().trim();
510510
if ("".equals(string)) {
511511
throw this.syntaxError("Missing value");
512+
} else if (jsonParserConfiguration != null &&
513+
jsonParserConfiguration.isStrictMode() && string.endsWith(".")) {
514+
throw this.syntaxError(String.format("Strict mode error: Value '%s' ends with dot", string));
512515
}
513516
Object obj = JSONObject.stringToValue(string);
514517
// if obj is a boolean, look at string

0 commit comments

Comments
 (0)