Skip to content

Commit 68b2629

Browse files
committed
JSONObject(JSONTokener) now points to last character of duplicate key
Updating exception message accordingly (position -1)
1 parent c365e2a commit 68b2629

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1988,7 +1988,7 @@ public void jsonObjectParsingErrors() {
19881988
fail("Expected an exception");
19891989
} catch (JSONException e) {
19901990
assertEquals("Expecting an expection message",
1991-
"Duplicate key \"attr03\" at 90 [character 13 line 5]",
1991+
"Duplicate key \"attr03\" at 89 [character 12 line 5]",
19921992
e.getMessage());
19931993
}
19941994
try {
@@ -2007,7 +2007,7 @@ public void jsonObjectParsingErrors() {
20072007
fail("Expected an exception");
20082008
} catch (JSONException e) {
20092009
assertEquals("Expecting an expection message",
2010-
"Duplicate key \"attr03\" at 90 [character 13 line 5]",
2010+
"Duplicate key \"attr03\" at 89 [character 12 line 5]",
20112011
e.getMessage());
20122012
}
20132013
try {
@@ -2028,7 +2028,7 @@ public void jsonObjectParsingErrors() {
20282028
fail("Expected an exception");
20292029
} catch (JSONException e) {
20302030
assertEquals("Expecting an expection message",
2031-
"Duplicate key \"attr03\" at 90 [character 13 line 5]",
2031+
"Duplicate key \"attr03\" at 89 [character 12 line 5]",
20322032
e.getMessage());
20332033
}
20342034
try {
@@ -2048,7 +2048,7 @@ public void jsonObjectParsingErrors() {
20482048
fail("Expected an exception");
20492049
} catch (JSONException e) {
20502050
assertEquals("Expecting an expection message",
2051-
"Duplicate key \"attr04-03\" at 215 [character 20 line 9]",
2051+
"Duplicate key \"attr04-03\" at 214 [character 19 line 9]",
20522052
e.getMessage());
20532053
}
20542054
try {
@@ -2072,7 +2072,7 @@ public void jsonObjectParsingErrors() {
20722072
fail("Expected an exception");
20732073
} catch (JSONException e) {
20742074
assertEquals("Expecting an expection message",
2075-
"Duplicate key \"attr04-03\" at 215 [character 20 line 9]",
2075+
"Duplicate key \"attr04-03\" at 214 [character 19 line 9]",
20762076
e.getMessage());
20772077
}
20782078
try {
@@ -2098,7 +2098,7 @@ public void jsonObjectParsingErrors() {
20982098
fail("Expected an exception");
20992099
} catch (JSONException e) {
21002100
assertEquals("Expecting an expection message",
2101-
"Duplicate key \"attr04-03\" at 215 [character 20 line 9]",
2101+
"Duplicate key \"attr04-03\" at 214 [character 19 line 9]",
21022102
e.getMessage());
21032103
}
21042104
try {
@@ -2117,7 +2117,7 @@ public void jsonObjectParsingErrors() {
21172117
fail("Expected an exception");
21182118
} catch (JSONException e) {
21192119
assertEquals("Expecting an expection message",
2120-
"Duplicate key \"attr01\" at 124 [character 17 line 8]",
2120+
"Duplicate key \"attr01\" at 123 [character 16 line 8]",
21212121
e.getMessage());
21222122
}
21232123
try {
@@ -2142,7 +2142,7 @@ public void jsonObjectParsingErrors() {
21422142
fail("Expected an exception");
21432143
} catch (JSONException e) {
21442144
assertEquals("Expecting an expection message",
2145-
"Duplicate key \"attr02-01\" at 269 [character 24 line 13]",
2145+
"Duplicate key \"attr02-01\" at 268 [character 23 line 13]",
21462146
e.getMessage());
21472147
}
21482148
}

0 commit comments

Comments
 (0)