Remove a redundant condition and an empty string

Remove "NULL.equals(object)" on line 2756 of JSONObject.java since line 2752 has already tested it.
Remove the empty string on line 249 of JSONPointer.java.
This commit is contained in:
AlexCai2019 2025-06-23 01:23:15 +08:00
parent 32e56da786
commit aac376f305
2 changed files with 2 additions and 3 deletions

View File

@ -2752,8 +2752,7 @@ public class JSONObject {
if (NULL.equals(object)) { if (NULL.equals(object)) {
return NULL; return NULL;
} }
if (object instanceof JSONObject || object instanceof JSONArray if (object instanceof JSONObject || object instanceof JSONArray || object instanceof JSONString
|| NULL.equals(object) || object instanceof JSONString
|| object instanceof Byte || object instanceof Character || object instanceof Byte || object instanceof Character
|| object instanceof Short || object instanceof Integer || object instanceof Short || object instanceof Integer
|| object instanceof Long || object instanceof Boolean || object instanceof Long || object instanceof Boolean

View File

@ -246,7 +246,7 @@ public class JSONPointer {
*/ */
@Override @Override
public String toString() { public String toString() {
StringBuilder rval = new StringBuilder(""); StringBuilder rval = new StringBuilder();
for (String token: this.refTokens) { for (String token: this.refTokens) {
rval.append('/').append(escape(token)); rval.append('/').append(escape(token));
} }