mirror of
https://github.com/stleary/JSON-java.git
synced 2025-08-03 03:15:32 -04:00
Revert "#863 replace short switch statements with if-else"
This reverts commit c010033591c192a0821bdd8fe23bc61cdc6fe738.
This commit is contained in:
parent
eda08415ca
commit
045324ab42
@ -216,11 +216,12 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
c = x.nextClean();
|
c = x.nextClean();
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (c == 0) {
|
switch (c) {
|
||||||
|
case 0:
|
||||||
throw x.syntaxError("A JSONObject text must end with '}'");
|
throw x.syntaxError("A JSONObject text must end with '}'");
|
||||||
} else if (c == '}') {
|
case '}':
|
||||||
return;
|
return;
|
||||||
} else {
|
default:
|
||||||
key = x.nextSimpleValue(c).toString();
|
key = x.nextSimpleValue(c).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,14 +397,15 @@ public class JSONTokener {
|
|||||||
*/
|
*/
|
||||||
public Object nextValue() throws JSONException {
|
public Object nextValue() throws JSONException {
|
||||||
char c = this.nextClean();
|
char c = this.nextClean();
|
||||||
if (c == '{') {
|
switch (c) {
|
||||||
|
case '{':
|
||||||
this.back();
|
this.back();
|
||||||
try {
|
try {
|
||||||
return new JSONObject(this);
|
return new JSONObject(this);
|
||||||
} catch (StackOverflowError e) {
|
} catch (StackOverflowError e) {
|
||||||
throw new JSONException("JSON Array or Object depth too large to process.", e);
|
throw new JSONException("JSON Array or Object depth too large to process.", e);
|
||||||
}
|
}
|
||||||
} else if (c == '[') {
|
case '[':
|
||||||
this.back();
|
this.back();
|
||||||
try {
|
try {
|
||||||
return new JSONArray(this);
|
return new JSONArray(this);
|
||||||
@ -418,7 +419,9 @@ public class JSONTokener {
|
|||||||
Object nextSimpleValue(char c) {
|
Object nextSimpleValue(char c) {
|
||||||
String string;
|
String string;
|
||||||
|
|
||||||
if (c == '"' || c == '\'') {
|
switch (c) {
|
||||||
|
case '"':
|
||||||
|
case '\'':
|
||||||
return this.nextString(c);
|
return this.nextString(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user