mirror of
https://github.com/stleary/JSON-java.git
synced 2025-08-03 11:25:30 -04:00
#863 replace short switch statements with if-else
This commit is contained in:
parent
5407423e43
commit
c010033591
@ -216,12 +216,11 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
c = x.nextClean();
|
c = x.nextClean();
|
||||||
for (;;) {
|
for (;;) {
|
||||||
switch (c) {
|
if (c == 0) {
|
||||||
case 0:
|
|
||||||
throw x.syntaxError("A JSONObject text must end with '}'");
|
throw x.syntaxError("A JSONObject text must end with '}'");
|
||||||
case '}':
|
} else if (c == '}') {
|
||||||
return;
|
return;
|
||||||
default:
|
} else {
|
||||||
key = x.nextSimpleValue(c).toString();
|
key = x.nextSimpleValue(c).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,15 +397,14 @@ public class JSONTokener {
|
|||||||
*/
|
*/
|
||||||
public Object nextValue() throws JSONException {
|
public Object nextValue() throws JSONException {
|
||||||
char c = this.nextClean();
|
char c = this.nextClean();
|
||||||
switch (c) {
|
if (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);
|
||||||
}
|
}
|
||||||
case '[':
|
} else if (c == '[') {
|
||||||
this.back();
|
this.back();
|
||||||
try {
|
try {
|
||||||
return new JSONArray(this);
|
return new JSONArray(this);
|
||||||
@ -419,9 +418,7 @@ public class JSONTokener {
|
|||||||
Object nextSimpleValue(char c) {
|
Object nextSimpleValue(char c) {
|
||||||
String string;
|
String string;
|
||||||
|
|
||||||
switch (c) {
|
if (c == '"' || c == '\'') {
|
||||||
case '"':
|
|
||||||
case '\'':
|
|
||||||
return this.nextString(c);
|
return this.nextString(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user