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:
parent
612dafc750
commit
dfa651e777
1 changed files with 5 additions and 1 deletions
|
@ -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 '\'':
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue