Committed by
Gerrit Code Review
Equals and Hashcode fix
Change-Id: Ieed2118375a92c9bc7cd370f51bba1a12d5cf009
Showing
1 changed file
with
3 additions
and
2 deletions
... | @@ -15,6 +15,7 @@ | ... | @@ -15,6 +15,7 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.bgpio.types; | 16 | package org.onosproject.bgpio.types; |
17 | 17 | ||
18 | +import java.util.Arrays; | ||
18 | import java.util.Objects; | 19 | import java.util.Objects; |
19 | 20 | ||
20 | import org.jboss.netty.buffer.ChannelBuffer; | 21 | import org.jboss.netty.buffer.ChannelBuffer; |
... | @@ -86,7 +87,7 @@ public class IPReachabilityInformationTlv implements BGPValueType { | ... | @@ -86,7 +87,7 @@ public class IPReachabilityInformationTlv implements BGPValueType { |
86 | 87 | ||
87 | @Override | 88 | @Override |
88 | public int hashCode() { | 89 | public int hashCode() { |
89 | - return Objects.hash(ipPrefix, prefixLen); | 90 | + return Objects.hash(Arrays.hashCode(ipPrefix), prefixLen); |
90 | } | 91 | } |
91 | 92 | ||
92 | @Override | 93 | @Override |
... | @@ -97,7 +98,7 @@ public class IPReachabilityInformationTlv implements BGPValueType { | ... | @@ -97,7 +98,7 @@ public class IPReachabilityInformationTlv implements BGPValueType { |
97 | 98 | ||
98 | if (obj instanceof IPReachabilityInformationTlv) { | 99 | if (obj instanceof IPReachabilityInformationTlv) { |
99 | IPReachabilityInformationTlv other = (IPReachabilityInformationTlv) obj; | 100 | IPReachabilityInformationTlv other = (IPReachabilityInformationTlv) obj; |
100 | - return Objects.equals(prefixLen, other.prefixLen) && Objects.equals(ipPrefix, other.ipPrefix); | 101 | + return Objects.equals(prefixLen, other.prefixLen) && Arrays.equals(ipPrefix, other.ipPrefix); |
101 | } | 102 | } |
102 | return false; | 103 | return false; |
103 | } | 104 | } | ... | ... |
-
Please register or login to post a comment