Committed by
Gerrit Code Review
Compare fix (Link)
Change-Id: Ia22eaecdcac8b2e77cc9a2831eec6814e66d6651
Showing
1 changed file
with
15 additions
and
10 deletions
| ... | @@ -261,6 +261,7 @@ public class BgpLinkLSIdentifier implements Comparable<Object> { | ... | @@ -261,6 +261,7 @@ public class BgpLinkLSIdentifier implements Comparable<Object> { |
| 261 | if (this.equals(o)) { | 261 | if (this.equals(o)) { |
| 262 | return 0; | 262 | return 0; |
| 263 | } | 263 | } |
| 264 | + boolean tlvFound = false; | ||
| 264 | int result = this.localNodeDescriptors.compareTo(((BgpLinkLSIdentifier) o).localNodeDescriptors); | 265 | int result = this.localNodeDescriptors.compareTo(((BgpLinkLSIdentifier) o).localNodeDescriptors); |
| 265 | if (result != 0) { | 266 | if (result != 0) { |
| 266 | return result; | 267 | return result; |
| ... | @@ -275,19 +276,23 @@ public class BgpLinkLSIdentifier implements Comparable<Object> { | ... | @@ -275,19 +276,23 @@ public class BgpLinkLSIdentifier implements Comparable<Object> { |
| 275 | } else { | 276 | } else { |
| 276 | return -1; | 277 | return -1; |
| 277 | } | 278 | } |
| 278 | - } | 279 | + } |
| 279 | ListIterator<BgpValueType> listIterator = linkDescriptor.listIterator(); | 280 | ListIterator<BgpValueType> listIterator = linkDescriptor.listIterator(); |
| 280 | - ListIterator<BgpValueType> listIteratorOther = ((BgpLinkLSIdentifier) o).linkDescriptor.listIterator(); | ||
| 281 | while (listIterator.hasNext()) { | 281 | while (listIterator.hasNext()) { |
| 282 | - BgpValueType tlv = listIterator.next(); | 282 | + BgpValueType tlv1 = listIterator.next(); |
| 283 | - if (linkDescriptor.contains(tlv) && ((BgpLinkLSIdentifier) o).linkDescriptor.contains(tlv)) { | 283 | + for (BgpValueType tlv : ((BgpLinkLSIdentifier) o).linkDescriptor) { |
| 284 | - int res = linkDescriptor.get(linkDescriptor.indexOf(tlv)).compareTo( | 284 | + if (tlv.getType() == tlv1.getType()) { |
| 285 | - ((BgpLinkLSIdentifier) o).linkDescriptor.get(((BgpLinkLSIdentifier) o).linkDescriptor | 285 | + result = linkDescriptor.get(linkDescriptor.indexOf(tlv1)).compareTo( |
| 286 | - .indexOf(tlv))); | 286 | + ((BgpLinkLSIdentifier) o).linkDescriptor.get(((BgpLinkLSIdentifier) o).linkDescriptor |
| 287 | - if (res != 0) { | 287 | + .indexOf(tlv))); |
| 288 | - return res; | 288 | + if (result != 0) { |
| 289 | + return result; | ||
| 290 | + } | ||
| 291 | + tlvFound = true; | ||
| 292 | + break; | ||
| 289 | } | 293 | } |
| 290 | - } else { | 294 | + } |
| 295 | + if (!tlvFound) { | ||
| 291 | return 1; | 296 | return 1; |
| 292 | } | 297 | } |
| 293 | } | 298 | } | ... | ... |
-
Please register or login to post a comment