@@ -277,7 +277,7 @@ private static boolean parse(XMLTokener x, JSONObject context, String name, bool
277277 if ("CDATA" .equals (token )) {
278278 if (x .next () == '[' ) {
279279 string = x .nextCDATA ();
280- if (! string .isEmpty () ) {
280+ if (string .length () > 0 ) {
281281 context .accumulate ("content" , string );
282282 }
283283 return false ;
@@ -353,7 +353,7 @@ private static boolean parse(XMLTokener x, JSONObject context, String name, bool
353353 if (x .nextToken () != GT ) {
354354 throw x .syntaxError ("Misshaped tag" );
355355 }
356- if (! jsonobject .isEmpty () ) {
356+ if (jsonobject .length () > 0 ) {
357357 context .accumulate (tagName , jsonobject );
358358 } else {
359359 context .accumulate (tagName , "" );
@@ -371,15 +371,15 @@ private static boolean parse(XMLTokener x, JSONObject context, String name, bool
371371 return false ;
372372 } else if (token instanceof String ) {
373373 string = (String ) token ;
374- if (! string .isEmpty () ) {
374+ if (string .length () > 0 ) {
375375 jsonobject .accumulate ("content" ,
376376 keepStrings ? string : stringToValue (string ));
377377 }
378378
379379 } else if (token == LT ) {
380380 // Nested element
381381 if (parse (x , jsonobject , tagName ,keepStrings )) {
382- if (jsonobject .isEmpty () ) {
382+ if (jsonobject .length () == 0 ) {
383383 context .accumulate (tagName , "" );
384384 } else if (jsonobject .length () == 1
385385 && jsonobject .opt ("content" ) != null ) {
@@ -676,7 +676,7 @@ public static String toString(final Object object, final String tagName)
676676
677677 string = (object == null ) ? "null" : escape (object .toString ());
678678 return (tagName == null ) ? "\" " + string + "\" "
679- : (string .isEmpty () ) ? "<" + tagName + "/>" : "<" + tagName
679+ : (string .length () == 0 ) ? "<" + tagName + "/>" : "<" + tagName
680680 + ">" + string + "</" + tagName + ">" ;
681681
682682 }
0 commit comments