#863 replace usage of back() method in JSONObject parsing

This commit is contained in:
Simulant 2024-03-05 22:11:24 +01:00
parent 63625b3c62
commit 5407423e43

View File

@ -214,8 +214,8 @@ public class JSONObject {
if (x.nextClean() != '{') { if (x.nextClean() != '{') {
throw x.syntaxError("A JSONObject text must begin with '{'"); throw x.syntaxError("A JSONObject text must begin with '{'");
} }
for (;;) {
c = x.nextClean(); c = x.nextClean();
for (;;) {
switch (c) { switch (c) {
case 0: case 0:
throw x.syntaxError("A JSONObject text must end with '}'"); throw x.syntaxError("A JSONObject text must end with '}'");
@ -252,13 +252,13 @@ public class JSONObject {
switch (x.nextClean()) { switch (x.nextClean()) {
case ';': case ';':
case ',': case ',':
if (x.nextClean() == '}') { c = x.nextClean();
if (c == '}') {
return; return;
} }
if (x.end()) { if (x.end()) {
throw x.syntaxError("A JSONObject text must end with '}'"); throw x.syntaxError("A JSONObject text must end with '}'");
} }
x.back();
break; break;
case '}': case '}':
return; return;