@@ -311,7 +311,7 @@ public char nextClean() throws JSONException {
311311 public String nextString (char quote ) throws JSONException {
312312 char c ;
313313 StringBuilder sb = new StringBuilder ();
314- for (; ; ) {
314+ for (;; ) {
315315 c = this .next ();
316316 switch (c ) {
317317 case 0 :
@@ -542,6 +542,8 @@ Object nextSimpleValue(char c) {
542542 }
543543
544544 Object nextSimpleValue (char c , boolean strictMode ) {
545+ String string ;
546+
545547 if (c == '"' || c == '\'' ) {
546548 String str = this .nextString (c );
547549 if (strictMode ) {
@@ -550,19 +552,6 @@ Object nextSimpleValue(char c, boolean strictMode) {
550552 return str ;
551553 }
552554
553- return parsedUnquotedText (c );
554- }
555-
556- /**
557- * Parses unquoted text from the JSON input. This could be the values true, false, or null, or it can be a number.
558- * Non-standard forms are also accepted. Characters are accumulated until the end of the text or a formatting
559- * character is reached.
560- *
561- * @param c The starting character.
562- * @return The parsed object.
563- * @throws JSONException If the parsed string is empty.
564- */
565- private Object parsedUnquotedText (char c ) {
566555 StringBuilder sb = new StringBuilder ();
567556 while (c >= ' ' && ",:]}/\\ \" [{;=#" .indexOf (c ) < 0 ) {
568557 sb .append (c );
@@ -572,8 +561,8 @@ private Object parsedUnquotedText(char c) {
572561 this .back ();
573562 }
574563
575- String string = sb .toString ().trim ();
576- if (string . isEmpty ( )) {
564+ string = sb .toString ().trim ();
565+ if ("" . equals ( string )) {
577566 throw this .syntaxError ("Missing value" );
578567 }
579568 return JSONObject .stringToValue (string );
0 commit comments