Skip to content

Commit 6c00792

Browse files
committed
Use Objects.equals()
1 parent 5776c61 commit 6c00792

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

exist-core/src/main/java/org/exist/security/internal/Password.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
*/
2222
package org.exist.security.internal;
2323

24+
import java.util.Objects;
2425
import java.util.regex.Matcher;
2526
import java.util.regex.Pattern;
2627
import org.apache.commons.codec.binary.Base64;
@@ -169,7 +170,7 @@ public boolean equals(Object obj) {
169170
throw new RuntimeException("Cannot compare passwords with different algorithms i.e. " + algorithm + " and " + p.algorithm);
170171
}
171172

172-
return (pw == p.pw || (pw != null && pw.equals(p.pw)));
173+
return (Objects.equals(pw, p.pw));
173174
}
174175

175176
if(obj instanceof String) {

exist-core/src/main/java/org/exist/xquery/functions/fn/FunDeepEqual.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555
import org.w3c.dom.NamedNodeMap;
5656
import org.w3c.dom.Node;
5757

58+
import java.util.Objects;
59+
5860
/**
5961
* Implements the fn:deep-equal library function.
6062
*
@@ -358,7 +360,7 @@ private static boolean compareNames(Node a, Node b) {
358360
}
359361

360362
private static boolean safeEquals(Object a, Object b) {
361-
return a == null ? b == null : a.equals(b);
363+
return Objects.equals(a, b);
362364
}
363365

364366
}

0 commit comments

Comments
 (0)