This commit is contained in:
坏黑
2018-05-08 23:31:26 +08:00
parent 674e993105
commit 19d318a610
89 changed files with 4664 additions and 2410 deletions

View File

@@ -32,7 +32,7 @@ public class Cookie {
while (x.more()) {
name = unescape(x.nextTo("=;"));
if (x.next() != '=') {
if (name.equals("secure")) {
if ("secure".equals(name)) {
value = Boolean.TRUE;
} else {
throw x.syntaxError("Missing '=' in cookie parameter.");

View File

@@ -86,11 +86,11 @@ public class JSONArray {
Object object = this.get(index);
if (object.equals(Boolean.FALSE) ||
(object instanceof String &&
((String) object).equalsIgnoreCase("false"))) {
"false".equalsIgnoreCase((String) object))) {
return false;
} else if (object.equals(Boolean.TRUE) ||
(object instanceof String &&
((String) object).equalsIgnoreCase("true"))) {
"true".equalsIgnoreCase((String) object))) {
return true;
}
throw new JSONException("JSONArray[" + index + "] is not a boolean.");

View File

@@ -46,7 +46,7 @@ public class JSONML {
break;
case '[':
token = x.nextToken();
if (token.equals("CDATA") && x.next() == '[') {
if ("CDATA".equals(token) && x.next() == '[') {
if (ja != null) {
ja.put(x.nextCDATA());
}

View File

@@ -109,7 +109,7 @@ public class JSONObject {
this.populateMap(bean);
}
public JSONObject(Object object, String names[]) {
public JSONObject(Object object, String[] names) {
this();
Class c = object.getClass();
for (String name : names) {
@@ -210,11 +210,11 @@ public class JSONObject {
Object object = this.get(key);
if (object.equals(Boolean.FALSE) ||
(object instanceof String &&
((String) object).equalsIgnoreCase("false"))) {
"false".equalsIgnoreCase((String) object))) {
return false;
} else if (object.equals(Boolean.TRUE) ||
(object instanceof String &&
((String) object).equalsIgnoreCase("true"))) {
"true".equalsIgnoreCase((String) object))) {
return true;
}
throw new JSONException("JSONObject[" + quote(key) +
@@ -322,16 +322,16 @@ public class JSONObject {
public static Object stringToValue(String string) {
Double d;
if (string.equals("")) {
if ("".equals(string)) {
return string;
}
if (string.equalsIgnoreCase("true")) {
if ("true".equalsIgnoreCase(string)) {
return Boolean.TRUE;
}
if (string.equalsIgnoreCase("false")) {
if ("false".equalsIgnoreCase(string)) {
return Boolean.FALSE;
}
if (string.equalsIgnoreCase("null")) {
if ("null".equalsIgnoreCase(string)) {
return JSONObject.NULL;
}
char b = string.charAt(0);

View File

@@ -11,7 +11,7 @@ public class JSONWriter {
protected char mode;
private final JSONObject stack[];
private final JSONObject[] stack;
private int top;