Satish K
Committed by Gerrit Code Review

Equals and Hashcode issue fix

Change-Id: I762b0628ec5aa12f97d1806c3e0f72aa961e91a9
......@@ -15,7 +15,7 @@
*/
package org.onosproject.pcepio.types;
import java.util.Objects;
import java.util.Arrays;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.pcepio.protocol.PcepVersion;
......@@ -95,7 +95,7 @@ public class IGPMetricTlv implements PcepValueType {
@Override
public int hashCode() {
return Objects.hash(rawValue);
return Arrays.hashCode(rawValue);
}
@Override
......@@ -105,7 +105,7 @@ public class IGPMetricTlv implements PcepValueType {
}
if (obj instanceof IGPMetricTlv) {
IGPMetricTlv other = (IGPMetricTlv) obj;
return Objects.equals(rawValue, other.rawValue);
return Arrays.equals(rawValue, other.rawValue);
}
return false;
}
......
......@@ -15,7 +15,7 @@
*/
package org.onosproject.pcepio.types;
import java.util.Objects;
import java.util.Arrays;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.pcepio.protocol.PcepVersion;
......@@ -127,7 +127,7 @@ public class IPv6InterfaceAddressTlv implements PcepValueType {
@Override
public int hashCode() {
return Objects.hash(rawValue);
return Arrays.hashCode(rawValue);
}
@Override
......@@ -137,7 +137,7 @@ public class IPv6InterfaceAddressTlv implements PcepValueType {
}
if (obj instanceof IPv6InterfaceAddressTlv) {
IPv6InterfaceAddressTlv other = (IPv6InterfaceAddressTlv) obj;
return Objects.equals(rawValue, other.rawValue);
return Arrays.equals(rawValue, other.rawValue);
}
return false;
}
......
......@@ -15,7 +15,7 @@
*/
package org.onosproject.pcepio.types;
import java.util.Objects;
import java.util.Arrays;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.pcepio.protocol.PcepVersion;
......@@ -125,7 +125,7 @@ public class IPv6NeighborAddressTlv implements PcepValueType {
@Override
public int hashCode() {
return Objects.hash(rawValue);
return Arrays.hashCode(rawValue);
}
@Override
......@@ -135,7 +135,7 @@ public class IPv6NeighborAddressTlv implements PcepValueType {
}
if (obj instanceof IPv6NeighborAddressTlv) {
IPv6NeighborAddressTlv other = (IPv6NeighborAddressTlv) obj;
return Objects.equals(rawValue, other.rawValue);
return Arrays.equals(rawValue, other.rawValue);
}
return false;
}
......
......@@ -23,7 +23,7 @@ import org.junit.Test;
*/
public class IGPMetricTlvTest {
private final byte[] b1 = new byte[] {0x01, 0x02};
private final byte[] b2 = new byte[] {0x01, 0x02};
private final byte[] b2 = new byte[] {0x01, 0x03};
private final IGPMetricTlv tlv1 = IGPMetricTlv.of(b1, (short) 2);
private final IGPMetricTlv sameAsTlv1 = IGPMetricTlv.of(b1, (short) 2);
private final IGPMetricTlv tlv2 = IGPMetricTlv.of(b2, (short) 2);
......
......@@ -25,8 +25,8 @@ public class IPv6InterfaceAddressTlvTest {
private final byte[] b1 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02,
(byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x29, 0x00, 0x02, 0x00, 0x00};
private final byte[] b2 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02,
(byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x30, 0x00, 0x02, 0x00, 0x00 };
private final byte[] b2 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02,
(byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x30, 0x00, 0x02, 0x00, 0x01};
private final IPv6InterfaceAddressTlv tlv1 = IPv6InterfaceAddressTlv.of(b1);
private final IPv6InterfaceAddressTlv sameAsTlv1 = IPv6InterfaceAddressTlv.of(b1);
......
......@@ -26,7 +26,7 @@ public class IPv6NeighborAddressTlvTest {
private final byte[] b1 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02,
(byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x29, 0x00, 0x02, 0x00, 0x00};
private final byte[] b2 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02,
(byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x30, 0x00, 0x02, 0x00, 0x00 };
(byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x30, 0x00, 0x02, 0x00, 0x01};
private final IPv6NeighborAddressTlv tlv1 = IPv6NeighborAddressTlv.of(b1);
private final IPv6NeighborAddressTlv sameAsTlv1 = IPv6NeighborAddressTlv.of(b1);
......