1
0
Fork 0
mirror of https://github.com/ethauvin/JSON-java.git synced 2025-06-17 07:50:52 -07:00

Make nextString throw a JSONException instead of a NumberFormatException for malformed input.

This commit is contained in:
Mads Ager 2016-06-02 15:56:48 +02:00
parent 612dafc750
commit dfa651e777

View file

@ -278,7 +278,11 @@ public class JSONTokener {
sb.append('\r'); sb.append('\r');
break; break;
case 'u': case 'u':
try {
sb.append((char)Integer.parseInt(this.next(4), 16)); sb.append((char)Integer.parseInt(this.next(4), 16));
} catch (NumberFormatException e) {
throw this.syntaxError("Illegal escape.");
}
break; break;
case '"': case '"':
case '\'': case '\'':