* Fix #2334 This commit replaces the `NumberFormatException` with `MalformedJsonException` in the `JsonReader#readEscapeCharacter()` and also fixes the tests. * Removes white-space
This commit is contained in:
parent
0adcdc80d5
commit
85ebaf7c35
|
@ -1587,7 +1587,7 @@ public class JsonReader implements Closeable {
|
||||||
* been read. This supports both unicode escapes "u000A" and two-character
|
* been read. This supports both unicode escapes "u000A" and two-character
|
||||||
* escapes "\n".
|
* escapes "\n".
|
||||||
*
|
*
|
||||||
* @throws NumberFormatException if any unicode escape sequences are
|
* @throws MalformedJsonException if any unicode escape sequences are
|
||||||
* malformed.
|
* malformed.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("fallthrough")
|
@SuppressWarnings("fallthrough")
|
||||||
|
@ -1614,7 +1614,7 @@ public class JsonReader implements Closeable {
|
||||||
} else if (c >= 'A' && c <= 'F') {
|
} else if (c >= 'A' && c <= 'F') {
|
||||||
result += (c - 'A' + 10);
|
result += (c - 'A' + 10);
|
||||||
} else {
|
} else {
|
||||||
throw new NumberFormatException("\\u" + new String(buffer, pos, 4));
|
throw new MalformedJsonException("\\u" + new String(buffer, pos, 4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pos += 4;
|
pos += 4;
|
||||||
|
|
|
@ -355,7 +355,7 @@ public final class JsonReaderTest {
|
||||||
try {
|
try {
|
||||||
reader.nextString();
|
reader.nextString();
|
||||||
fail();
|
fail();
|
||||||
} catch (NumberFormatException expected) {
|
} catch (MalformedJsonException expected) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue