mirror of
https://github.com/fankes/JSON-java-compat.git
synced 2025-09-09 20:14:28 +08:00
Simplify the check for object keys that are themselves objects.
For object keys, we can just skip the part of `nextValue()` that parses values that are objects or arrays. Then the existing logic for unquoted values will already stop at `{` or `[`, and that will produce a `Missing value` exception.
This commit is contained in:
@@ -2230,7 +2230,7 @@ public class JSONObjectTest {
|
||||
assertNull("Expected an exception",new JSONObject(str));
|
||||
} catch (JSONException e) {
|
||||
assertEquals("Expecting an exception message",
|
||||
"Nested object not expected here. at 2 [character 3 line 1]",
|
||||
"Missing value at 1 [character 2 line 1]",
|
||||
e.getMessage());
|
||||
}
|
||||
try {
|
||||
@@ -2239,7 +2239,7 @@ public class JSONObjectTest {
|
||||
assertNull("Expected an exception",new JSONObject(str));
|
||||
} catch (JSONException e) {
|
||||
assertEquals("Expecting an exception message",
|
||||
"Nested array not expected here. at 10 [character 11 line 1]",
|
||||
"Missing value at 9 [character 10 line 1]",
|
||||
e.getMessage());
|
||||
}
|
||||
try {
|
||||
|
Reference in New Issue
Block a user