You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2026/07/20 10:04:50 UTC
(tomcat) branch 11.0.x updated: Fix equals() and hashCode(). Need to use pattern string.
This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push:
new e7227721c7 Fix equals() and hashCode(). Need to use pattern string.
e7227721c7 is described below
commit e7227721c7f28030c6bf0e840db8a404e3ac5d69
Author: Mark Thomas <ma...@apache.org>
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: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org