Satish K
Committed by Gerrit Code Review

Equals and Hashcode issue fix

Change-Id: I762b0628ec5aa12f97d1806c3e0f72aa961e91a9
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
15 */ 15 */
16 package org.onosproject.pcepio.types; 16 package org.onosproject.pcepio.types;
17 17
18 -import java.util.Objects; 18 +import java.util.Arrays;
19 19
20 import org.jboss.netty.buffer.ChannelBuffer; 20 import org.jboss.netty.buffer.ChannelBuffer;
21 import org.onosproject.pcepio.protocol.PcepVersion; 21 import org.onosproject.pcepio.protocol.PcepVersion;
...@@ -95,7 +95,7 @@ public class IGPMetricTlv implements PcepValueType { ...@@ -95,7 +95,7 @@ public class IGPMetricTlv implements PcepValueType {
95 95
96 @Override 96 @Override
97 public int hashCode() { 97 public int hashCode() {
98 - return Objects.hash(rawValue); 98 + return Arrays.hashCode(rawValue);
99 } 99 }
100 100
101 @Override 101 @Override
...@@ -105,7 +105,7 @@ public class IGPMetricTlv implements PcepValueType { ...@@ -105,7 +105,7 @@ public class IGPMetricTlv implements PcepValueType {
105 } 105 }
106 if (obj instanceof IGPMetricTlv) { 106 if (obj instanceof IGPMetricTlv) {
107 IGPMetricTlv other = (IGPMetricTlv) obj; 107 IGPMetricTlv other = (IGPMetricTlv) obj;
108 - return Objects.equals(rawValue, other.rawValue); 108 + return Arrays.equals(rawValue, other.rawValue);
109 } 109 }
110 return false; 110 return false;
111 } 111 }
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
15 */ 15 */
16 package org.onosproject.pcepio.types; 16 package org.onosproject.pcepio.types;
17 17
18 -import java.util.Objects; 18 +import java.util.Arrays;
19 19
20 import org.jboss.netty.buffer.ChannelBuffer; 20 import org.jboss.netty.buffer.ChannelBuffer;
21 import org.onosproject.pcepio.protocol.PcepVersion; 21 import org.onosproject.pcepio.protocol.PcepVersion;
...@@ -127,7 +127,7 @@ public class IPv6InterfaceAddressTlv implements PcepValueType { ...@@ -127,7 +127,7 @@ public class IPv6InterfaceAddressTlv implements PcepValueType {
127 127
128 @Override 128 @Override
129 public int hashCode() { 129 public int hashCode() {
130 - return Objects.hash(rawValue); 130 + return Arrays.hashCode(rawValue);
131 } 131 }
132 132
133 @Override 133 @Override
...@@ -137,7 +137,7 @@ public class IPv6InterfaceAddressTlv implements PcepValueType { ...@@ -137,7 +137,7 @@ public class IPv6InterfaceAddressTlv implements PcepValueType {
137 } 137 }
138 if (obj instanceof IPv6InterfaceAddressTlv) { 138 if (obj instanceof IPv6InterfaceAddressTlv) {
139 IPv6InterfaceAddressTlv other = (IPv6InterfaceAddressTlv) obj; 139 IPv6InterfaceAddressTlv other = (IPv6InterfaceAddressTlv) obj;
140 - return Objects.equals(rawValue, other.rawValue); 140 + return Arrays.equals(rawValue, other.rawValue);
141 } 141 }
142 return false; 142 return false;
143 } 143 }
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
15 */ 15 */
16 package org.onosproject.pcepio.types; 16 package org.onosproject.pcepio.types;
17 17
18 -import java.util.Objects; 18 +import java.util.Arrays;
19 19
20 import org.jboss.netty.buffer.ChannelBuffer; 20 import org.jboss.netty.buffer.ChannelBuffer;
21 import org.onosproject.pcepio.protocol.PcepVersion; 21 import org.onosproject.pcepio.protocol.PcepVersion;
...@@ -125,7 +125,7 @@ public class IPv6NeighborAddressTlv implements PcepValueType { ...@@ -125,7 +125,7 @@ public class IPv6NeighborAddressTlv implements PcepValueType {
125 125
126 @Override 126 @Override
127 public int hashCode() { 127 public int hashCode() {
128 - return Objects.hash(rawValue); 128 + return Arrays.hashCode(rawValue);
129 } 129 }
130 130
131 @Override 131 @Override
...@@ -135,7 +135,7 @@ public class IPv6NeighborAddressTlv implements PcepValueType { ...@@ -135,7 +135,7 @@ public class IPv6NeighborAddressTlv implements PcepValueType {
135 } 135 }
136 if (obj instanceof IPv6NeighborAddressTlv) { 136 if (obj instanceof IPv6NeighborAddressTlv) {
137 IPv6NeighborAddressTlv other = (IPv6NeighborAddressTlv) obj; 137 IPv6NeighborAddressTlv other = (IPv6NeighborAddressTlv) obj;
138 - return Objects.equals(rawValue, other.rawValue); 138 + return Arrays.equals(rawValue, other.rawValue);
139 } 139 }
140 return false; 140 return false;
141 } 141 }
......
...@@ -23,7 +23,7 @@ import org.junit.Test; ...@@ -23,7 +23,7 @@ import org.junit.Test;
23 */ 23 */
24 public class IGPMetricTlvTest { 24 public class IGPMetricTlvTest {
25 private final byte[] b1 = new byte[] {0x01, 0x02}; 25 private final byte[] b1 = new byte[] {0x01, 0x02};
26 - private final byte[] b2 = new byte[] {0x01, 0x02}; 26 + private final byte[] b2 = new byte[] {0x01, 0x03};
27 private final IGPMetricTlv tlv1 = IGPMetricTlv.of(b1, (short) 2); 27 private final IGPMetricTlv tlv1 = IGPMetricTlv.of(b1, (short) 2);
28 private final IGPMetricTlv sameAsTlv1 = IGPMetricTlv.of(b1, (short) 2); 28 private final IGPMetricTlv sameAsTlv1 = IGPMetricTlv.of(b1, (short) 2);
29 private final IGPMetricTlv tlv2 = IGPMetricTlv.of(b2, (short) 2); 29 private final IGPMetricTlv tlv2 = IGPMetricTlv.of(b2, (short) 2);
......
...@@ -25,8 +25,8 @@ public class IPv6InterfaceAddressTlvTest { ...@@ -25,8 +25,8 @@ public class IPv6InterfaceAddressTlvTest {
25 25
26 private final byte[] b1 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 26 private final byte[] b1 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02,
27 (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x29, 0x00, 0x02, 0x00, 0x00}; 27 (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x29, 0x00, 0x02, 0x00, 0x00};
28 - private final byte[] b2 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 28 + private final byte[] b2 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02,
29 - (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x30, 0x00, 0x02, 0x00, 0x00 }; 29 + (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x30, 0x00, 0x02, 0x00, 0x01};
30 30
31 private final IPv6InterfaceAddressTlv tlv1 = IPv6InterfaceAddressTlv.of(b1); 31 private final IPv6InterfaceAddressTlv tlv1 = IPv6InterfaceAddressTlv.of(b1);
32 private final IPv6InterfaceAddressTlv sameAsTlv1 = IPv6InterfaceAddressTlv.of(b1); 32 private final IPv6InterfaceAddressTlv sameAsTlv1 = IPv6InterfaceAddressTlv.of(b1);
......
...@@ -26,7 +26,7 @@ public class IPv6NeighborAddressTlvTest { ...@@ -26,7 +26,7 @@ public class IPv6NeighborAddressTlvTest {
26 private final byte[] b1 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 26 private final byte[] b1 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02,
27 (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x29, 0x00, 0x02, 0x00, 0x00}; 27 (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x29, 0x00, 0x02, 0x00, 0x00};
28 private final byte[] b2 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 28 private final byte[] b2 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02,
29 - (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x30, 0x00, 0x02, 0x00, 0x00 }; 29 + (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x30, 0x00, 0x02, 0x00, 0x01};
30 30
31 private final IPv6NeighborAddressTlv tlv1 = IPv6NeighborAddressTlv.of(b1); 31 private final IPv6NeighborAddressTlv tlv1 = IPv6NeighborAddressTlv.of(b1);
32 private final IPv6NeighborAddressTlv sameAsTlv1 = IPv6NeighborAddressTlv.of(b1); 32 private final IPv6NeighborAddressTlv sameAsTlv1 = IPv6NeighborAddressTlv.of(b1);
......