mirror of
https://github.com/stleary/JSON-java.git
synced 2025-08-02 11:05:28 -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();
|
||||
for (;;) {
|
||||
switch (c) {
|
||||
case 0:
|
||||
if (c == 0) {
|
||||
throw x.syntaxError("A JSONObject text must end with '}'");
|
||||
case '}':
|
||||
} else if (c == '}') {
|
||||
return;
|
||||
default:
|
||||
} else {
|
||||
key = x.nextSimpleValue(c).toString();
|
||||
}
|
||||
|
||||
|
@ -397,15 +397,14 @@ public class JSONTokener {
|
||||
*/
|
||||
public Object nextValue() throws JSONException {
|
||||
char c = this.nextClean();
|
||||
switch (c) {
|
||||
case '{':
|
||||
if (c == '{') {
|
||||
this.back();
|
||||
try {
|
||||
return new JSONObject(this);
|
||||
} catch (StackOverflowError e) {
|
||||
throw new JSONException("JSON Array or Object depth too large to process.", e);
|
||||
}
|
||||
case '[':
|
||||
} else if (c == '[') {
|
||||
this.back();
|
||||
try {
|
||||
return new JSONArray(this);
|
||||
@ -419,9 +418,7 @@ public class JSONTokener {
|
||||
Object nextSimpleValue(char c) {
|
||||
String string;
|
||||
|
||||
switch (c) {
|
||||
case '"':
|
||||
case '\'':
|
||||
if (c == '"' || c == '\'') {
|
||||
return this.nextString(c);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user