Priyanka B
Committed by Gerrit Code Review

Compare fix (Link)

Change-Id: Ia22eaecdcac8b2e77cc9a2831eec6814e66d6651
......@@ -261,6 +261,7 @@ public class BgpLinkLSIdentifier implements Comparable<Object> {
if (this.equals(o)) {
return 0;
}
boolean tlvFound = false;
int result = this.localNodeDescriptors.compareTo(((BgpLinkLSIdentifier) o).localNodeDescriptors);
if (result != 0) {
return result;
......@@ -277,17 +278,21 @@ public class BgpLinkLSIdentifier implements Comparable<Object> {
}
}
ListIterator<BgpValueType> listIterator = linkDescriptor.listIterator();
ListIterator<BgpValueType> listIteratorOther = ((BgpLinkLSIdentifier) o).linkDescriptor.listIterator();
while (listIterator.hasNext()) {
BgpValueType tlv = listIterator.next();
if (linkDescriptor.contains(tlv) && ((BgpLinkLSIdentifier) o).linkDescriptor.contains(tlv)) {
int res = linkDescriptor.get(linkDescriptor.indexOf(tlv)).compareTo(
BgpValueType tlv1 = listIterator.next();
for (BgpValueType tlv : ((BgpLinkLSIdentifier) o).linkDescriptor) {
if (tlv.getType() == tlv1.getType()) {
result = linkDescriptor.get(linkDescriptor.indexOf(tlv1)).compareTo(
((BgpLinkLSIdentifier) o).linkDescriptor.get(((BgpLinkLSIdentifier) o).linkDescriptor
.indexOf(tlv)));
if (res != 0) {
return res;
if (result != 0) {
return result;
}
} else {
tlvFound = true;
break;
}
}
if (!tlvFound) {
return 1;
}
}
......