From 16dea216bcf513b95e6fba40d3703c2a93142fff Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Tue, 24 Oct 2023 17:10:53 -0500 Subject: [PATCH] Fixes #10760 - Remove StringUtil.equals --- .../java/org/eclipse/jetty/util/StringUtil.java | 17 ----------------- .../eclipse/jetty/util/resource/Resource.java | 3 ++- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/StringUtil.java b/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/StringUtil.java index 0386e74e3ac5..eb8afdd71001 100644 --- a/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/StringUtil.java +++ b/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/StringUtil.java @@ -259,23 +259,6 @@ public static boolean asciiEqualsIgnoreCase(String string, String other) return true; } - /** - * Check for string equality. - * @param string The string to check - * @param other The other string to check - * @return true if the strings are equal. - */ - public static boolean equals(String string, String other) - { - if (string == null) - return other == null; - - if (other == null) - return false; - - return string.equals(other); - } - /** * Check for a string prefix, ignoring {@link StandardCharsets#US_ASCII} case differences. * @param string The string to check diff --git a/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/resource/Resource.java b/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/resource/Resource.java index 50dbea9bf285..ff5ee5c07971 100644 --- a/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/resource/Resource.java +++ b/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/resource/Resource.java @@ -28,6 +28,7 @@ import java.util.Collection; import java.util.Iterator; import java.util.List; +import java.util.Objects; import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.StringUtil; @@ -97,7 +98,7 @@ public boolean contains(Resource other) return false; // Different authorities? not a valid contains() check - if (!StringUtil.equals(thisURI.getAuthority(), otherURI.getAuthority())) + if (!Objects.equals(thisURI.getAuthority(), otherURI.getAuthority())) return false; // Ensure that if `file` scheme is used, it's using a consistent convention to allow for startsWith check