Skip to content

Commit bd92888

Browse files
committed
In JSONTokener.nextValue(), accepts erroneous values (with spaces in
middle). Better handling of end of stream.
1 parent 1a811f1 commit bd92888

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

JSONTokener.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,11 +444,13 @@ public Object nextValue() throws JSONException {
444444
*/
445445

446446
StringBuilder sb = new StringBuilder();
447-
while (c >= ' ' && ",:]}/\\\"[{;=#".indexOf(c) < 0) {
447+
while (c > ' ' && ",:]}/\\\"[{;=#".indexOf(c) < 0) {
448448
sb.append(c);
449449
c = this.next();
450450
}
451-
this.back();
451+
if( false == this.eof ) {
452+
this.back();
453+
}
452454

453455
string = sb.toString().trim();
454456
if ("".equals(string)) {

0 commit comments

Comments
 (0)