mirror of
https://github.com/fankes/JSON-java-compat.git
synced 2025-09-07 03:06:03 +08:00
@@ -107,7 +107,13 @@ public class JSONArray implements Iterable<Object> {
|
|||||||
if (x.nextClean() != '[') {
|
if (x.nextClean() != '[') {
|
||||||
throw x.syntaxError("A JSONArray text must start with '['");
|
throw x.syntaxError("A JSONArray text must start with '['");
|
||||||
}
|
}
|
||||||
if (x.nextClean() != ']') {
|
|
||||||
|
char nextChar = x.nextClean();
|
||||||
|
if (nextChar == 0) {
|
||||||
|
// array is unclosed. No ']' found, instead EOF
|
||||||
|
throw new JSONException(x.syntaxError("Expected a ',' or ']'"));
|
||||||
|
}
|
||||||
|
if (nextChar != ']') {
|
||||||
x.back();
|
x.back();
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (x.nextClean() == ',') {
|
if (x.nextClean() == ',') {
|
||||||
@@ -118,8 +124,16 @@ public class JSONArray implements Iterable<Object> {
|
|||||||
this.myArrayList.add(x.nextValue());
|
this.myArrayList.add(x.nextValue());
|
||||||
}
|
}
|
||||||
switch (x.nextClean()) {
|
switch (x.nextClean()) {
|
||||||
|
case 0:
|
||||||
|
// array is unclosed. No ']' found, instead EOF
|
||||||
|
throw new JSONException(x.syntaxError("Expected a ',' or ']'"));
|
||||||
case ',':
|
case ',':
|
||||||
if (x.nextClean() == ']') {
|
nextChar = x.nextClean();
|
||||||
|
if (nextChar == 0) {
|
||||||
|
// array is unclosed. No ']' found, instead EOF
|
||||||
|
throw new JSONException(x.syntaxError("Expected a ',' or ']'"));
|
||||||
|
}
|
||||||
|
if (nextChar == ']') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
x.back();
|
x.back();
|
||||||
|
Reference in New Issue
Block a user