1
0
Fork 0
mirror of https://github.com/ethauvin/JSON-java.git synced 2025-06-17 07:50:52 -07:00

Fixes spelling in comments and removes compile time warnings

This commit is contained in:
John J. Aylward 2017-05-16 15:35:05 -04:00
parent ae1e9e2b6a
commit c870094f69
7 changed files with 82 additions and 54 deletions

View file

@ -211,7 +211,7 @@ public class XML {
sb.append('<');
} else if ("gt".equalsIgnoreCase(entity)) {
sb.append('>');
} else {
} else {// unsupported xml entity. leave encoded
sb.append('&').append(entity).append(';');
}
}
@ -219,7 +219,7 @@ public class XML {
i += entity.length() + 1;
} else {
// this shouldn't happen in most cases since the parser
// errors on unclosed enties.
// errors on unclosed entries.
sb.append(c);
}
} else {
@ -508,7 +508,7 @@ public class XML {
* @return A string.
* @throws JSONException Thrown if there is an error parsing the string
*/
public static String toString(Object object, String tagName)
public static String toString(final Object object, final String tagName)
throws JSONException {
StringBuilder sb = new StringBuilder();
JSONArray ja;
@ -595,21 +595,19 @@ public class XML {
}
if (object != null) {
if (object.getClass().isArray()) {
object = new JSONArray(object);
}
if (object instanceof JSONArray) {
if (object != null && (object instanceof JSONArray || object.getClass().isArray())) {
if(object.getClass().isArray()) {
ja = new JSONArray(object);
} else {
ja = (JSONArray) object;
for (Object val : ja) {
// XML does not have good support for arrays. If an array
// appears in a place where XML is lacking, synthesize an
// <array> element.
sb.append(toString(val, tagName == null ? "array" : tagName));
}
return sb.toString();
}
for (Object val : ja) {
// XML does not have good support for arrays. If an array
// appears in a place where XML is lacking, synthesize an
// <array> element.
sb.append(toString(val, tagName == null ? "array" : tagName));
}
return sb.toString();
}
string = (object == null) ? "null" : escape(object.toString());