Skip to content

Commit 8001bcd

Browse files
committed
fixing leadin zero bug
1 parent 1c8ac84 commit 8001bcd

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

core/src/main/java/org/everit/json/schema/internal/RelativeJsonPointerFormatValidator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ private char curr() {
6262
}
6363

6464
private void parseUpwardsStepCount() throws ParseException {
65-
if (!isDigit(curr())) {
65+
if (!isDigit(curr()) || curr() == '0') {
6666
fail();
6767
}
6868
for (char current = next(); isDigit(current) && pos < input.length(); current = next())

core/src/test/java/org/everit/json/schema/internal/RelativeJsonPointerFormatValidatorTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,8 @@ public void noUpwardsStepCount() {
7575
assertFailure("/foo/bar", SUBJECT, "[/foo/bar] is not a valid relative JSON Pointer");
7676
}
7777

78+
@Test
79+
public void leadingZeroFailure() {
80+
assertFailure("0123", SUBJECT, "[0123] is not a valid relative JSON Pointer");
81+
}
7882
}

0 commit comments

Comments
 (0)