mirror of
https://github.com/ethauvin/JSON-java.git
synced 2025-06-16 23:40:51 -07:00
fix typo
This commit is contained in:
parent
4b49bc94ce
commit
4990c3a180
4 changed files with 29 additions and 30 deletions
|
@ -1409,7 +1409,7 @@ public class JSONArray implements Iterable<Object> {
|
|||
public Writer write(Writer writer, int indentFactor, int indent)
|
||||
throws JSONException {
|
||||
try {
|
||||
boolean commanate = false;
|
||||
boolean hasComma = false;
|
||||
int length = this.length();
|
||||
writer.write('[');
|
||||
|
||||
|
@ -1421,23 +1421,23 @@ public class JSONArray implements Iterable<Object> {
|
|||
throw new JSONException("Unable to write JSONArray value at index: 0", e);
|
||||
}
|
||||
} else if (length != 0) {
|
||||
final int newindent = indent + indentFactor;
|
||||
final int newIndent = indent + indentFactor;
|
||||
|
||||
for (int i = 0; i < length; i += 1) {
|
||||
if (commanate) {
|
||||
if (hasComma) {
|
||||
writer.write(',');
|
||||
}
|
||||
if (indentFactor > 0) {
|
||||
writer.write('\n');
|
||||
}
|
||||
JSONObject.indent(writer, newindent);
|
||||
JSONObject.indent(writer, newIndent);
|
||||
try {
|
||||
JSONObject.writeValue(writer, this.myArrayList.get(i),
|
||||
indentFactor, newindent);
|
||||
indentFactor, newIndent);
|
||||
} catch (Exception e) {
|
||||
throw new JSONException("Unable to write JSONArray value at index: " + i, e);
|
||||
}
|
||||
commanate = true;
|
||||
hasComma = true;
|
||||
}
|
||||
if (indentFactor > 0) {
|
||||
writer.write('\n');
|
||||
|
|
|
@ -2141,7 +2141,7 @@ public class JSONObject {
|
|||
//}
|
||||
//return new BigInteger(val);
|
||||
|
||||
// BigInteger version: We use a similar bitLenth compare as
|
||||
// BigInteger version: We use a similar bitLength compare as
|
||||
// BigInteger#intValueExact uses. Increases GC, but objects hold
|
||||
// only what they need. i.e. Less runtime overhead if the value is
|
||||
// long lived. Which is the better tradeoff? This is closer to what's
|
||||
|
@ -2496,7 +2496,7 @@ public class JSONObject {
|
|||
public Writer write(Writer writer, int indentFactor, int indent)
|
||||
throws JSONException {
|
||||
try {
|
||||
boolean commanate = false;
|
||||
boolean hasComma = false;
|
||||
final int length = this.length();
|
||||
writer.write('{');
|
||||
|
||||
|
@ -2514,15 +2514,15 @@ public class JSONObject {
|
|||
throw new JSONException("Unable to write JSONObject value for key: " + key, e);
|
||||
}
|
||||
} else if (length != 0) {
|
||||
final int newindent = indent + indentFactor;
|
||||
final int newIndent = indent + indentFactor;
|
||||
for (final Entry<String,?> entry : this.entrySet()) {
|
||||
if (commanate) {
|
||||
if (hasComma) {
|
||||
writer.write(',');
|
||||
}
|
||||
if (indentFactor > 0) {
|
||||
writer.write('\n');
|
||||
}
|
||||
indent(writer, newindent);
|
||||
indent(writer, newIndent);
|
||||
final String key = entry.getKey();
|
||||
writer.write(quote(key));
|
||||
writer.write(':');
|
||||
|
@ -2530,11 +2530,11 @@ public class JSONObject {
|
|||
writer.write(' ');
|
||||
}
|
||||
try {
|
||||
writeValue(writer, entry.getValue(), indentFactor, newindent);
|
||||
writeValue(writer, entry.getValue(), indentFactor, newIndent);
|
||||
} catch (Exception e) {
|
||||
throw new JSONException("Unable to write JSONObject value for key: " + key, e);
|
||||
}
|
||||
commanate = true;
|
||||
hasComma = true;
|
||||
}
|
||||
if (indentFactor > 0) {
|
||||
writer.write('\n');
|
||||
|
|
31
XML.java
31
XML.java
|
@ -66,7 +66,7 @@ public class XML {
|
|||
public static final Character SLASH = '/';
|
||||
|
||||
/**
|
||||
* Null attrubute name
|
||||
* Null attribute name
|
||||
*/
|
||||
public static final String NULL_ATTR = "xsi:nil";
|
||||
|
||||
|
@ -251,7 +251,7 @@ public class XML {
|
|||
throws JSONException {
|
||||
char c;
|
||||
int i;
|
||||
JSONObject jsonobject = null;
|
||||
JSONObject jsonObject = null;
|
||||
String string;
|
||||
String tagName;
|
||||
Object token;
|
||||
|
@ -332,7 +332,7 @@ public class XML {
|
|||
} else {
|
||||
tagName = (String) token;
|
||||
token = null;
|
||||
jsonobject = new JSONObject();
|
||||
jsonObject = new JSONObject();
|
||||
boolean nilAttributeFound = false;
|
||||
for (;;) {
|
||||
if (token == null) {
|
||||
|
@ -353,14 +353,14 @@ public class XML {
|
|||
&& Boolean.parseBoolean((String) token)) {
|
||||
nilAttributeFound = true;
|
||||
} else if (!nilAttributeFound) {
|
||||
jsonobject.accumulate(string,
|
||||
jsonObject.accumulate(string,
|
||||
config.keepStrings
|
||||
? ((String) token)
|
||||
: stringToValue((String) token));
|
||||
}
|
||||
token = null;
|
||||
} else {
|
||||
jsonobject.accumulate(string, "");
|
||||
jsonObject.accumulate(string, "");
|
||||
}
|
||||
|
||||
|
||||
|
@ -371,8 +371,8 @@ public class XML {
|
|||
}
|
||||
if (nilAttributeFound) {
|
||||
context.accumulate(tagName, JSONObject.NULL);
|
||||
} else if (jsonobject.length() > 0) {
|
||||
context.accumulate(tagName, jsonobject);
|
||||
} else if (jsonObject.length() > 0) {
|
||||
context.accumulate(tagName, jsonObject);
|
||||
} else {
|
||||
context.accumulate(tagName, "");
|
||||
}
|
||||
|
@ -390,21 +390,20 @@ public class XML {
|
|||
} else if (token instanceof String) {
|
||||
string = (String) token;
|
||||
if (string.length() > 0) {
|
||||
jsonobject.accumulate(config.cDataTagName,
|
||||
jsonObject.accumulate(config.cDataTagName,
|
||||
config.keepStrings ? string : stringToValue(string));
|
||||
}
|
||||
|
||||
} else if (token == LT) {
|
||||
// Nested element
|
||||
if (parse(x, jsonobject, tagName, config)) {
|
||||
if (jsonobject.length() == 0) {
|
||||
if (parse(x, jsonObject, tagName, config)) {
|
||||
if (jsonObject.length() == 0) {
|
||||
context.accumulate(tagName, "");
|
||||
} else if (jsonobject.length() == 1
|
||||
&& jsonobject.opt(config.cDataTagName) != null) {
|
||||
context.accumulate(tagName,
|
||||
jsonobject.opt(config.cDataTagName));
|
||||
} else if (jsonObject.length() == 1
|
||||
&& jsonObject.opt(config.cDataTagName) != null) {
|
||||
context.accumulate(tagName, jsonObject.opt(config.cDataTagName));
|
||||
} else {
|
||||
context.accumulate(tagName, jsonobject);
|
||||
context.accumulate(tagName, jsonObject);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -731,7 +730,7 @@ public class XML {
|
|||
}
|
||||
if (tagName != null) {
|
||||
|
||||
// Emit the </tagname> close tag
|
||||
// Emit the </tagName> close tag
|
||||
sb.append("</");
|
||||
sb.append(tagName);
|
||||
sb.append('>');
|
||||
|
|
|
@ -152,7 +152,7 @@ public class XMLTokener extends JSONTokener {
|
|||
}
|
||||
|
||||
/**
|
||||
* Unescapes an XML entity encoding;
|
||||
* Unescape an XML entity encoding;
|
||||
* @param e entity (only the actual entity value, not the preceding & or ending ;
|
||||
* @return
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue