File tree Expand file tree Collapse file tree 4 files changed +2
-81
lines changed Expand file tree Collapse file tree 4 files changed +2
-81
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ class JsonBuffer {
2020
2121 private final String buffer ;
2222 private int position ;
23- private boolean eof ;
2423
2524 public JsonBuffer (final String buffer ) {
2625 this .buffer = buffer ;
@@ -35,19 +34,11 @@ public void setPosition(final int position) {
3534 }
3635
3736 public int read () {
38- if (eof ) {
39- throw new JsonParseException ("Trying to read past EOF." );
40- } else if (position >= buffer .length ()) {
41- eof = true ;
42- return -1 ;
43- } else {
44- return buffer .charAt (position ++);
45- }
37+ return (position >= buffer .length ()) ? -1 : buffer .charAt (position ++);
4638 }
4739
4840 public void unread (final int c ) {
4941 if (c != -1 && buffer .charAt (position - 1 ) == c ) {
50- eof = false ;
5142 position --;
5243 }
5344 }
Original file line number Diff line number Diff line change @@ -134,9 +134,6 @@ private JsonToken scanRegularExpression() {
134134 switch (state ) {
135135 case IN_PATTERN :
136136 switch (c ) {
137- case -1 :
138- state = RegularExpressionState .INVALID ;
139- break ;
140137 case '/' :
141138 state = RegularExpressionState .IN_OPTIONS ;
142139 options = buffer .getPosition ();
@@ -177,7 +174,6 @@ private JsonToken scanRegularExpression() {
177174 }
178175 break ;
179176 default :
180- break ;
181177 }
182178
183179 switch (state ) {
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -503,15 +503,7 @@ public void testInvalidRegularExpression() {
503503 String json = "\t /pattern/nsk," ;
504504 JsonBuffer buffer = new JsonBuffer (json );
505505 JsonScanner scanner = new JsonScanner (buffer );
506- scanner .nextToken ();
507- }
508-
509- @ Test (expected = JsonParseException .class )
510- public void testInvalidRegularExpressionNoEnd () {
511- String json = "/b" ;
512- JsonBuffer buffer = new JsonBuffer (json );
513- JsonScanner scanner = new JsonScanner (buffer );
514- scanner .nextToken ();
506+ JsonToken token = scanner .nextToken ();
515507 }
516508
517509 @ Test (expected = JsonParseException .class )
You can’t perform that action at this time.
0 commit comments