mirror of
https://github.com/ethauvin/JSON-java.git
synced 2025-06-17 07:50:52 -07:00
Fixes position reports on errors
This commit is contained in:
parent
1add1247fa
commit
e7e6ed9205
3 changed files with 67 additions and 48 deletions
|
@ -64,11 +64,8 @@ public class XMLTokener extends JSONTokener {
|
|||
char c;
|
||||
int i;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (;;) {
|
||||
while (more()) {
|
||||
c = next();
|
||||
if (end()) {
|
||||
throw syntaxError("Unclosed CDATA");
|
||||
}
|
||||
sb.append(c);
|
||||
i = sb.length() - 3;
|
||||
if (i >= 0 && sb.charAt(i) == ']' &&
|
||||
|
@ -77,6 +74,7 @@ public class XMLTokener extends JSONTokener {
|
|||
return sb.toString();
|
||||
}
|
||||
}
|
||||
throw syntaxError("Unclosed CDATA");
|
||||
}
|
||||
|
||||
|
||||
|
@ -103,7 +101,10 @@ public class XMLTokener extends JSONTokener {
|
|||
}
|
||||
sb = new StringBuilder();
|
||||
for (;;) {
|
||||
if (c == '<' || c == 0) {
|
||||
if (c == 0) {
|
||||
return sb.toString().trim();
|
||||
}
|
||||
if (c == '<') {
|
||||
back();
|
||||
return sb.toString().trim();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue