Optimize isNonAddPathBestPathTheSame() 18/94318/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 30 Dec 2020 22:54:43 +0000 (23:54 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 31 Dec 2020 00:19:03 +0000 (01:19 +0100)
This is an Eclipse automatic logic optimization: in case of bestPath
being empty/null, we do not need to evaluate the second part of the
expression.

Change-Id: I96010fd93ca24f2ac1684e6d5117e59acfe2bae0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
bgp/path-selection-mode/src/main/java/org/opendaylight/protocol/bgp/mode/impl/add/AddPathAbstractRouteEntry.java

index 56eab86aeff32fc1cba342d1f7821663efb1e930..d6dee37a26b7415c54bff69697d5dab3bef22354 100644 (file)
@@ -252,7 +252,7 @@ public abstract class AddPathAbstractRouteEntry<C extends Routes & DataObject &
     }
 
     private boolean isNonAddPathBestPathTheSame(final List<AddPathBestPath> newBestPathList) {
-        return !(isEmptyOrNull(this.bestPath) || isEmptyOrNull(newBestPathList))
+        return (!isEmptyOrNull(this.bestPath) && !isEmptyOrNull(newBestPathList))
                 && this.bestPath.get(0).equals(newBestPathList.get(0));
     }