(tomcat) branch main updated: Fix equals() and hashCode(). Need to use pattern string.
[email protected] Mon, 20 Jul 2026 10:04:46 +0000
| Newsgroups | gmane.comp.jakarta.tomcat.devel |
|---|---|
| Message-ID | <178454188687.4023822.1331240647515850983@gitbox3-he-fi.apache.org> |
This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new 347a1c91e1 Fix equals() and hashCode(). Need to use pattern string.
347a1c91e1 is described below
commit 347a1c91e1523f640ebc5112eb26b3405f560fd9
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;
}