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