This is an automated email from the ASF dual-hosted git repository.
zrlw pushed a commit to branch 3.3
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.3 by this push:
new 7cee17d0a0 Fix unstable test URLTest.testHashcode (#15757)
7cee17d0a0 is described below
commit 7cee17d0a07aeae444f67445e76a469feadfffcb
Author: Anshul Bisht <[email protected]>
AuthorDate: Sun Nov 9 20:12:07 2025 -0600
Fix unstable test URLTest.testHashcode (#15757)
---
.../java/org/apache/dubbo/common/url/component/URLParam.java | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git
a/dubbo-common/src/main/java/org/apache/dubbo/common/url/component/URLParam.java
b/dubbo-common/src/main/java/org/apache/dubbo/common/url/component/URLParam.java
index fd6c97caea..6a11ef68f9 100644
---
a/dubbo-common/src/main/java/org/apache/dubbo/common/url/component/URLParam.java
+++
b/dubbo-common/src/main/java/org/apache/dubbo/common/url/component/URLParam.java
@@ -890,15 +890,17 @@ public class URLParam {
@Override
public int hashCode() {
if (hashCodeCache == -1) {
+ int result = 1;
for (Map.Entry<String, String> entry : EXTRA_PARAMS.entrySet()) {
if (!TIMESTAMP_KEY.equals(entry.getKey())) {
- hashCodeCache = hashCodeCache * 31 +
Objects.hashCode(entry);
+ result += entry.hashCode();
}
}
- for (Integer value : VALUE) {
- hashCodeCache = hashCodeCache * 31 + value;
- }
- hashCodeCache = hashCodeCache * 31 + ((KEY == null) ? 0 :
KEY.hashCode());
+
+ result = 31 * result + Arrays.hashCode(VALUE);
+ result = 31 * result + ((KEY == null) ? 0 : KEY.hashCode());
+
+ hashCodeCache = result;
}
return hashCodeCache;
}