Merge if statements 12/103412/1
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 26 Nov 2022 09:53:23 +0000 (10:53 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Sat, 26 Nov 2022 09:53:23 +0000 (10:53 +0100)
Sonar is reporting this violation, fix it.

Change-Id: Iae2ae38e84fd89962bb2ec2eeddab2228e33c11f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
data/yang-data-tree-ri/src/main/java/org/opendaylight/yangtools/yang/data/tree/impl/MandatoryDescendant.java

index 14d2671e45af58b95232d4a2c406b126af721f6b..65373e2d4a395db92bfb893547658e57b59c593a 100644 (file)
@@ -73,12 +73,10 @@ final class MandatoryDescendant implements Immutable {
             return;
         }
         // ... if we have a legacy path, try that as well ...
-        if (legacyPath != null) {
-            if (NormalizedNodes.findNode(data, legacyPath).isPresent()) {
-                // .. this should not really be happening ...
-                LOG.debug("Found {} at alternate path {}", path, legacyPath);
-                return;
-            }
+        if (legacyPath != null && NormalizedNodes.findNode(data, legacyPath).isPresent()) {
+            // .. this should not really be happening ...
+            LOG.debug("Found {} at alternate path {}", path, legacyPath);
+            return;
         }
 
         // ... not found, report the error