From 76d98dfbb3f8b85a8a93cbb44a3d86e34205a841 Mon Sep 17 00:00:00 2001 From: "ding.lid" Date: Mon, 14 Nov 2011 06:15:44 +0000 Subject: [PATCH] =?UTF-8?q?URL=E7=9A=84Equal=E5=88=A4=E6=96=AD=E5=8A=A0?= =?UTF-8?q?=E4=B8=8A=20Parameters=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://code.alibabatech.com/svn/dubbo/trunk@257 1a56cb94-b969-4eaa-88fa-be21384802f2 --- .../java/com/alibaba/dubbo/common/URL.java | 83 ++++++++++--------- 1 file changed, 45 insertions(+), 38 deletions(-) diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/URL.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/URL.java index 78bfafde2c..b3bf0054f9 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/URL.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/URL.java @@ -965,46 +965,53 @@ public final class URL implements Serializable { return getParameter(Constants.INTERFACE_KEY, path); } - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((host == null) ? 0 : host.hashCode()); - result = prime * result + ((path == null) ? 0 : path.hashCode()); - result = prime * result + port; - result = prime * result - + ((protocol == null) ? 0 : protocol.hashCode()); - return result; - } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((host == null) ? 0 : host.hashCode()); + result = prime * result + ((parameters == null) ? 0 : parameters.hashCode()); + result = prime * result + ((path == null) ? 0 : path.hashCode()); + result = prime * result + port; + result = prime * result + ((protocol == null) ? 0 : protocol.hashCode()); + return result; + } - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - URL other = (URL) obj; - if (host == null) { - if (other.host != null) - return false; - } else if (!host.equals(other.host)) - return false; - if (path == null) { - if (other.path != null) - return false; - } else if (!path.equals(other.path)) - return false; - if (port != other.port) - return false; - if (protocol == null) { - if (other.protocol != null) - return false; - } else if (!protocol.equals(other.protocol)) - return false; - return true; - } + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + URL other = (URL) obj; + if (host == null) { + if (other.host != null) + return false; + } else if (!host.equals(other.host)) + return false; + if (parameters == null) { + if (other.parameters != null) + return false; + } else if (!parameters.equals(other.parameters)) + return false; + if (path == null) { + if (other.path != null) + return false; + } else if (!path.equals(other.path)) + return false; + if (port != other.port) + return false; + if (protocol == null) { + if (other.protocol != null) + return false; + } else if (!protocol.equals(other.protocol)) + return false; + return true; + } - /** + /** * @deprecated Replace to getParameter(String, int) * @see #getParameter(String, int) */