Committed by
Gerrit Code Review
Compare fix (Link)
Change-Id: Ia22eaecdcac8b2e77cc9a2831eec6814e66d6651
Showing
1 changed file
with
12 additions
and
7 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; |
... | @@ -277,17 +278,21 @@ public class BgpLinkLSIdentifier implements Comparable<Object> { | ... | @@ -277,17 +278,21 @@ public class BgpLinkLSIdentifier implements Comparable<Object> { |
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 | + result = linkDescriptor.get(linkDescriptor.indexOf(tlv1)).compareTo( | ||
285 | ((BgpLinkLSIdentifier) o).linkDescriptor.get(((BgpLinkLSIdentifier) o).linkDescriptor | 286 | ((BgpLinkLSIdentifier) o).linkDescriptor.get(((BgpLinkLSIdentifier) o).linkDescriptor |
286 | .indexOf(tlv))); | 287 | .indexOf(tlv))); |
287 | - if (res != 0) { | 288 | + if (result != 0) { |
288 | - return res; | 289 | + return result; |
289 | } | 290 | } |
290 | - } else { | 291 | + tlvFound = true; |
292 | + break; | ||
293 | + } | ||
294 | + } | ||
295 | + if (!tlvFound) { | ||
291 | return 1; | 296 | return 1; |
292 | } | 297 | } |
293 | } | 298 | } | ... | ... |
-
Please register or login to post a comment