This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 087af0f9d8 Fix equals() and hashCode(). Need to use pattern string.
087af0f9d8 is described below
commit 087af0f9d86362bfb79710bedcaeab31e5517306
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Jul 20 11:04:34 2026 +0100
Fix equals() and hashCode(). Need to use pattern string.
Pattern object just delegates to Object so implements object identity.
---
java/org/apache/catalina/util/NetMask.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/java/org/apache/catalina/util/NetMask.java
b/java/org/apache/catalina/util/NetMask.java
index 8b5f7e02ce..70ca7839ad 100644
--- a/java/org/apache/catalina/util/NetMask.java
+++ b/java/org/apache/catalina/util/NetMask.java
@@ -307,7 +307,7 @@ public final class NetMask {
return false;
}
if (foundPort) {
- return Objects.equals(portPattern, other.portPattern);
+ return Objects.equals(portPattern.pattern(),
other.portPattern.pattern());
}
return true;
}
@@ -316,7 +316,7 @@ public final class NetMask {
public int hashCode() {
int result = 31 * (31 * Arrays.hashCode(netaddr) + nrBytes) +
lastByteShift;
if (foundPort) {
- result = 31 * result + portPattern.hashCode();
+ result = 31 * result + portPattern.pattern().hashCode();
}
return result;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]