Skip to content

Commit 7cad4c3

Browse files
committed
partially revert changes
1 parent 0507438 commit 7cad4c3

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

CDL.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public static JSONArray toJSONArray(JSONArray names, String string)
224224
*/
225225
public static JSONArray toJSONArray(JSONArray names, JSONTokener x)
226226
throws JSONException {
227-
if (names == null || names.isEmpty()) {
227+
if (names == null || names.length() == 0) {
228228
return null;
229229
}
230230
JSONArray ja = new JSONArray();
@@ -235,7 +235,7 @@ public static JSONArray toJSONArray(JSONArray names, JSONTokener x)
235235
}
236236
ja.put(jo);
237237
}
238-
if (ja.isEmpty()) {
238+
if (ja.length() == 0) {
239239
return null;
240240
}
241241
return ja;
@@ -272,7 +272,7 @@ public static String toString(JSONArray ja) throws JSONException {
272272
*/
273273
public static String toString(JSONArray names, JSONArray ja)
274274
throws JSONException {
275-
if (names == null || names.isEmpty()) {
275+
if (names == null || names.length() == 0) {
276276
return null;
277277
}
278278
StringBuffer sb = new StringBuffer();

JSONML.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ private static Object parse(
178178
newjo.accumulate(attribute, "");
179179
}
180180
}
181-
if (arrayForm && !newjo.isEmpty()) {
181+
if (arrayForm && newjo.length() > 0) {
182182
newja.put(newjo);
183183
}
184184

@@ -208,7 +208,7 @@ private static Object parse(
208208
"' and '" + closeTag + "'");
209209
}
210210
tagName = null;
211-
if (!arrayForm && !newja.isEmpty()) {
211+
if (!arrayForm && newja.length() > 0) {
212212
newjo.put("childNodes", newja);
213213
}
214214
if (ja == null) {

XML.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)