Skip to content

Commit aac376f

Browse files
committed
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.
1 parent 32e56da commit aac376f

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/main/java/org/json/JSONObject.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2752,8 +2752,7 @@ private static Object wrap(Object object, Set<Object> objectsRecord, int recursi
27522752
if (NULL.equals(object)) {
27532753
return NULL;
27542754
}
2755-
if (object instanceof JSONObject || object instanceof JSONArray
2756-
|| NULL.equals(object) || object instanceof JSONString
2755+
if (object instanceof JSONObject || object instanceof JSONArray || object instanceof JSONString
27572756
|| object instanceof Byte || object instanceof Character
27582757
|| object instanceof Short || object instanceof Integer
27592758
|| object instanceof Long || object instanceof Boolean

src/main/java/org/json/JSONPointer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ private static Object readByIndexToken(Object current, String indexToken) throws
246246
*/
247247
@Override
248248
public String toString() {
249-
StringBuilder rval = new StringBuilder("");
249+
StringBuilder rval = new StringBuilder();
250250
for (String token: this.refTokens) {
251251
rval.append('/').append(escape(token));
252252
}

0 commit comments

Comments
 (0)