@@ -277,7 +277,7 @@ private static boolean parse(XMLTokener x, JSONObject context, String name, bool
277
277
if ("CDATA" .equals (token )) {
278
278
if (x .next () == '[' ) {
279
279
string = x .nextCDATA ();
280
- if (! string .isEmpty () ) {
280
+ if (string .length () > 0 ) {
281
281
context .accumulate ("content" , string );
282
282
}
283
283
return false ;
@@ -353,7 +353,7 @@ private static boolean parse(XMLTokener x, JSONObject context, String name, bool
353
353
if (x .nextToken () != GT ) {
354
354
throw x .syntaxError ("Misshaped tag" );
355
355
}
356
- if (! jsonobject .isEmpty () ) {
356
+ if (jsonobject .length () > 0 ) {
357
357
context .accumulate (tagName , jsonobject );
358
358
} else {
359
359
context .accumulate (tagName , "" );
@@ -371,15 +371,15 @@ private static boolean parse(XMLTokener x, JSONObject context, String name, bool
371
371
return false ;
372
372
} else if (token instanceof String ) {
373
373
string = (String ) token ;
374
- if (! string .isEmpty () ) {
374
+ if (string .length () > 0 ) {
375
375
jsonobject .accumulate ("content" ,
376
376
keepStrings ? string : stringToValue (string ));
377
377
}
378
378
379
379
} else if (token == LT ) {
380
380
// Nested element
381
381
if (parse (x , jsonobject , tagName ,keepStrings )) {
382
- if (jsonobject .isEmpty () ) {
382
+ if (jsonobject .length () == 0 ) {
383
383
context .accumulate (tagName , "" );
384
384
} else if (jsonobject .length () == 1
385
385
&& jsonobject .opt ("content" ) != null ) {
@@ -676,7 +676,7 @@ public static String toString(final Object object, final String tagName)
676
676
677
677
string = (object == null ) ? "null" : escape (object .toString ());
678
678
return (tagName == null ) ? "\" " + string + "\" "
679
- : (string .isEmpty () ) ? "<" + tagName + "/>" : "<" + tagName
679
+ : (string .length () == 0 ) ? "<" + tagName + "/>" : "<" + tagName
680
680
+ ">" + string + "</" + tagName + ">" ;
681
681
682
682
}
0 commit comments