Skip to content

Commit c7fdada

Browse files
committed
Add test that an invalid escape sequence results in a JSONException and not a NumberFormatException.
1 parent 51bcbeb commit c7fdada

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/test/org/json/junit/JSONObjectTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1924,4 +1924,10 @@ public void optQueryWithNoResult() {
19241924
public void optQueryWithSyntaxError() {
19251925
new JSONObject().optQuery("invalid");
19261926
}
1927+
1928+
@Test(expected = JSONException.class)
1929+
public void invalidEscapeSequence() {
1930+
String json = "{ \"\\url\": \"value\" }";
1931+
new JSONObject(json);
1932+
}
19271933
}

0 commit comments

Comments
 (0)