mirror of
https://github.com/fankes/JSON-java-compat.git
synced 2025-09-07 03:06:03 +08:00
Make nextString throw a JSONException instead of a NumberFormatException for malformed input.
This commit is contained in:
@@ -278,7 +278,11 @@ public class JSONTokener {
|
|||||||
sb.append('\r');
|
sb.append('\r');
|
||||||
break;
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
sb.append((char)Integer.parseInt(this.next(4), 16));
|
try {
|
||||||
|
sb.append((char)Integer.parseInt(this.next(4), 16));
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
throw this.syntaxError("Illegal escape.");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case '"':
|
case '"':
|
||||||
case '\'':
|
case '\'':
|
||||||
|
Reference in New Issue
Block a user