mirror of
https://github.com/stleary/JSON-java.git
synced 2025-08-03 03:15:32 -04:00
Revert "#863 improve performance of JSONTokener#nextString"
This reverts commit 63625b3c622407273d2654660be7659ac5d74db7.
This commit is contained in:
parent
5974fc1a38
commit
0c5cf18255
@ -295,9 +295,12 @@ public class JSONTokener {
|
|||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for (;;) {
|
for (;;) {
|
||||||
c = this.next();
|
c = this.next();
|
||||||
if (c == quote) {
|
switch (c) {
|
||||||
return sb.toString();
|
case 0:
|
||||||
} else if (c == '\\') {
|
case '\n':
|
||||||
|
case '\r':
|
||||||
|
throw this.syntaxError("Unterminated string");
|
||||||
|
case '\\':
|
||||||
c = this.next();
|
c = this.next();
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'b':
|
case 'b':
|
||||||
@ -331,9 +334,11 @@ public class JSONTokener {
|
|||||||
default:
|
default:
|
||||||
throw this.syntaxError("Illegal escape.");
|
throw this.syntaxError("Illegal escape.");
|
||||||
}
|
}
|
||||||
} else if (c == 0 || c == '\n' || c == '\r') {
|
break;
|
||||||
throw this.syntaxError("Unterminated string");
|
default:
|
||||||
} else {
|
if (c == quote) {
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
sb.append(c);
|
sb.append(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user