(String msg)
| 433 | } |
| 434 | |
| 435 | protected ParseException err(String msg) { |
| 436 | // We can't tell if EOF was hit by comparing start<=end |
| 437 | // because the illegal char could have been the last in the buffer |
| 438 | // or in the stream. To deal with this, the "eof" var was introduced |
| 439 | if (!eof && start > 0) start--; // backup one char |
| 440 | String chs = "char=" + ((start >= end) ? "(EOF)" : "" + buf[start]); |
| 441 | String pos = "position=" + (gpos + start); |
| 442 | String tot = chs + ',' + pos + getContext(); |
| 443 | if (msg == null) { |
| 444 | if (start >= end) msg = "Unexpected EOF"; |
| 445 | else msg = "JSON Parse Error"; |
| 446 | } |
| 447 | return new ParseException(msg + ": " + tot); |
| 448 | } |
| 449 | |
| 450 | private String getContext() { |
| 451 | String context = ""; |
no test coverage detected