mirror of
https://github.com/stleary/JSON-java.git
synced 2025-08-02 19:15:27 -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();
|
||||
for (;;) {
|
||||
c = this.next();
|
||||
if (c == quote) {
|
||||
return sb.toString();
|
||||
} else if (c == '\\') {
|
||||
switch (c) {
|
||||
case 0:
|
||||
case '\n':
|
||||
case '\r':
|
||||
throw this.syntaxError("Unterminated string");
|
||||
case '\\':
|
||||
c = this.next();
|
||||
switch (c) {
|
||||
case 'b':
|
||||
@ -331,9 +334,11 @@ public class JSONTokener {
|
||||
default:
|
||||
throw this.syntaxError("Illegal escape.");
|
||||
}
|
||||
} else if (c == 0 || c == '\n' || c == '\r') {
|
||||
throw this.syntaxError("Unterminated string");
|
||||
} else {
|
||||
break;
|
||||
default:
|
||||
if (c == quote) {
|
||||
return sb.toString();
|
||||
}
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user