Merge "Clarify NotificationListener purpose"
authorTony Tkacik <ttkacik@cisco.com>
Fri, 19 Dec 2014 08:59:22 +0000 (08:59 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 19 Dec 2014 08:59:22 +0000 (08:59 +0000)
15 files changed:
code-generator/binding-generator-impl/src/main/java/org/opendaylight/yangtools/sal/binding/generator/util/DefaultSourceCodeGenerator.java
code-generator/binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/EnumTemplate.xtend
code-generator/maven-sal-api-gen-plugin/pom.xml
common/concepts/src/main/java/org/opendaylight/yangtools/concepts/AbstractRegistration.java
common/parent/pom.xml
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/DataTreeState.java
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/InMemoryDataTree.java
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/InMemoryDataTreeModification.java
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/ModifiedNode.java
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/NormalizedNodeContainerModificationStrategy.java
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/OperationWithModification.java
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/SchemaAwareApplyOperation.java
yang/yang-data-operations/src/main/java/org/opendaylight/yangtools/yang/data/operations/OperationStack.java
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/SchemaContextUtil.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/UsesNodeBuilderImpl.java

index 5df91cdc86e5d19ac14df300f9b8ab9212503dad..a98ccee3021753e9087397e4cd98b1f3d9306404 100644 (file)
@@ -81,8 +81,9 @@ public class DefaultSourceCodeGenerator implements SourceCodeGenerator {
             CtClass[] paramTypes = method.getParameterTypes();
             if (paramTypes != null) {
                 for (int i = 0; i < paramTypes.length; i++) {
-                    if (i > 0)
+                    if (i > 0) {
                         builder.append(", ");
+                    }
                     builder.append(paramTypes[i].getName()).append(" $")
                             .append(i + 1);
                 }
index cc05fb49120d10dbfc12e065d76440dd837ae6f8..417451bc181eee82bc51d14c51909aeb56430d8c 100644 (file)
@@ -58,14 +58,16 @@ class EnumTemplate extends BaseTemplate {
 
 
             int value;
-            static java.util.Map<java.lang.Integer, «enums.name»> valueMap;
+            private static final java.util.Map<java.lang.Integer, «enums.name»> VALUE_MAP;
 
             static {
-                valueMap = new java.util.HashMap<>();
+                final com.google.common.collect.ImmutableMap.Builder<java.lang.Integer, «enums.name»> b = com.google.common.collect.ImmutableMap.builder();
                 for («enums.name» enumItem : «enums.name».values())
                 {
-                    valueMap.put(enumItem.value, enumItem);
+                    b.put(enumItem.value, enumItem);
                 }
+
+                VALUE_MAP = b.build();
             }
         
             private «enums.name»(int value) {
@@ -84,7 +86,7 @@ class EnumTemplate extends BaseTemplate {
              * @return corresponding «enums.name» item
              */
             public static «enums.name» forValue(int valueArg) {
-                return valueMap.get(valueArg);
+                return VALUE_MAP.get(valueArg);
             }
         }
     '''
index ec862465669992981b907c253a7a25a1b664ca06..f8ccd295a21b245bc927a267b9821857177939cf 100644 (file)
             <artifactId>plexus-slf4j-logging</artifactId>
         </dependency>
 
-        <dependency>
-            <groupId>org.sonatype.sisu</groupId>
-            <artifactId>sisu-guava</artifactId>
-            <version>0.11.1</version>
-            <scope>runtime</scope>
-        </dependency>
-
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
index f5016e391c7ae38da25849ab924417ba96c26807..c07b38b3ff7515ba064ff63d1701e537616b4a11 100644 (file)
@@ -18,8 +18,6 @@ import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
 public abstract class AbstractRegistration implements AutoCloseable {
     private static final AtomicIntegerFieldUpdater<AbstractRegistration> CLOSED_UPDATER =
             AtomicIntegerFieldUpdater.newUpdater(AbstractRegistration.class, "closed");
-
-    @SuppressWarnings("unused") // updated by CLOSED_UPDATER
     private volatile int closed = 0;
 
     /**
@@ -36,7 +34,7 @@ public abstract class AbstractRegistration implements AutoCloseable {
      * @return true if the registration was closed, false otherwise.
      */
     protected final boolean isClosed() {
-        return CLOSED_UPDATER.get(this) != 0;
+        return closed != 0;
     }
 
     @Override
index 277ad18dd9e25fea9fcb88ceb8789c017152410c..7a213959341bd941e4f29f6a3d045d521fed8f3f 100644 (file)
             <dependency>
                 <groupId>org.apache.maven</groupId>
                 <artifactId>maven-core</artifactId>
-                <version>3.0.5</version>
+                <version>3.1.1</version>
             </dependency>
             <dependency>
                 <groupId>org.apache.maven</groupId>
                 <artifactId>maven-plugin-api</artifactId>
-                <version>3.0.5</version>
+                <version>3.1.1</version>
             </dependency>
             <dependency>
                 <groupId>org.javassist</groupId>
         </pluginManagement>
 
         <plugins>
-            <!--
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-enforcer-plugin</artifactId>
-                <version>1.0</version>
+                <!--
                 <executions>
                     <execution>
-                        <id>enforce</id>
+                        <id>enforce-dependencies</id>
                         <configuration>
                             <rules>
                                 <DependencyConvergence />
                         </goals>
                     </execution>
                 </executions>
+                -->
             </plugin>
-            -->
+
             <plugin>
                 <artifactId>maven-clean-plugin</artifactId>
                 <version>2.5</version>
index db1a8d17b127e743660f273e50d777cf70d74b94..9419d08f67566b36643348972afcbb6da2b8bef0 100644 (file)
@@ -7,6 +7,7 @@
  */
 package org.opendaylight.yangtools.yang.data.impl.schema.tree;
 
+import com.google.common.base.Objects;
 import com.google.common.base.Preconditions;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.TreeNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
@@ -54,4 +55,10 @@ final class DataTreeState {
     DataTreeState withRoot(final TreeNode newRoot) {
         return new DataTreeState(newRoot, holder, schemaContext);
     }
+
+    @Override
+    public String toString() {
+        final TreeNode r = root;
+        return Objects.toStringHelper(this).add("data", StoreUtils.toStringTree(r.getData())).toString();
+    }
 }
\ No newline at end of file
index dd1f00ed5e21a67cba5706e303ba90c43322c7df..9d60ed0a9b022f40e53384f60b6a0b9c06f85de5 100644 (file)
@@ -7,6 +7,7 @@
  */
 package org.opendaylight.yangtools.yang.data.impl.schema.tree;
 
+import com.google.common.base.Objects;
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import java.util.Collections;
@@ -122,4 +123,9 @@ final class InMemoryDataTree implements DataTree {
             LOG.trace("Updated state from {} to {}", currentState, newState);
         } while (!STATE_UPDATER.compareAndSet(this, currentState, newState));
     }
+
+    @Override
+    public String toString() {
+        return Objects.toStringHelper(this).add("object", super.toString()).add("state", state).toString();
+    }
 }
index 9e0c60f6a091bad054cd1c35c8b2630346be71c9..eef5d1f73f13d47769407ebddeffac7626ea41e6 100644 (file)
@@ -14,7 +14,6 @@ import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.ModificationType;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.TreeNode;
@@ -61,29 +60,17 @@ final class InMemoryDataTreeModification implements DataTreeModification {
     }
 
     @Override
-    public void write(final YangInstanceIdentifier path, final NormalizedNode<?, ?> value) {
+    public void write(final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
         checkSealed();
 
-        resolveModificationFor(path).write(value);
+        resolveModificationFor(path).write(data);
     }
 
     @Override
     public void merge(final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
         checkSealed();
 
-        mergeImpl(resolveModificationFor(path),data);
-    }
-
-    private void mergeImpl(final OperationWithModification op,final NormalizedNode<?,?> data) {
-        if (data instanceof NormalizedNodeContainer<?,?,?>) {
-            @SuppressWarnings({ "rawtypes", "unchecked" })
-            NormalizedNodeContainer<?,?,NormalizedNode<PathArgument, ?>> dataContainer = (NormalizedNodeContainer) data;
-            for(NormalizedNode<PathArgument, ?> child : dataContainer.getValue()) {
-                PathArgument childId = child.getIdentifier();
-                mergeImpl(op.forChild(childId), child);
-            }
-        }
-        op.merge(data);
+        resolveModificationFor(path).merge(data);
     }
 
     @Override
index c4933d08b3aeb22c46d76f778cb8a358ece0ecfc..ecda366de034c91513cbe452c8841e121c055179 100644 (file)
@@ -11,7 +11,11 @@ import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.base.Predicate;
 import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
 import javax.annotation.Nonnull;
+import javax.annotation.concurrent.NotThreadSafe;
 import org.opendaylight.yangtools.concepts.Identifiable;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
@@ -19,10 +23,6 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.ModificationType;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.StoreTreeNode;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.TreeNode;
 
-import javax.annotation.concurrent.GuardedBy;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
 /**
  * Node Modification Node and Tree
  *
@@ -32,6 +32,7 @@ import java.util.Map;
  * This tree is lazily created and populated via {@link #modifyChild(PathArgument)}
  * and {@link StoreMetadataNode} which represents original state {@link #getOriginal()}.
  */
+@NotThreadSafe
 final class ModifiedNode implements StoreTreeNode<ModifiedNode>, Identifiable<PathArgument>, NodeModification {
 
     public static final Predicate<ModifiedNode> IS_TERMINAL_PREDICATE = new Predicate<ModifiedNode>() {
@@ -59,7 +60,7 @@ final class ModifiedNode implements StoreTreeNode<ModifiedNode>, Identifiable<Pa
     private Optional<TreeNode> snapshotCache;
     private NormalizedNode<?, ?> value;
 
-    private ModifiedNode(final PathArgument identifier, final Optional<TreeNode> original, boolean isOrdered) {
+    private ModifiedNode(final PathArgument identifier, final Optional<TreeNode> original, final boolean isOrdered) {
         this.identifier = identifier;
         this.original = original;
 
@@ -129,7 +130,7 @@ final class ModifiedNode implements StoreTreeNode<ModifiedNode>, Identifiable<Pa
      * @return {@link org.opendaylight.controller.md.sal.dom.store.impl.tree.data.ModifiedNode} for specified child, with {@link #getOriginal()}
      *         containing child metadata if child was present in original data.
      */
-    public ModifiedNode modifyChild(final PathArgument child, boolean isOrdered) {
+    public ModifiedNode modifyChild(final PathArgument child, final boolean isOrdered) {
         clearSnapshot();
         if (modificationType == ModificationType.UNMODIFIED) {
             updateModificationType(ModificationType.SUBTREE_MODIFIED);
@@ -169,10 +170,35 @@ final class ModifiedNode implements StoreTreeNode<ModifiedNode>, Identifiable<Pa
      *
      */
     public void delete() {
+        final ModificationType newType;
+
+        switch (modificationType) {
+        case DELETE:
+        case UNMODIFIED:
+            // We need to record this delete.
+            newType = ModificationType.DELETE;
+            break;
+        case MERGE:
+        case SUBTREE_MODIFIED:
+        case WRITE:
+            /*
+             * We are canceling a previous modification. This is a bit tricky,
+             * as the original write may have just introduced the data, or it
+             * may have modified it.
+             *
+             * As documented in BUG-2470, a delete of data introduced in this
+             * transaction needs to be turned into a no-op.
+             */
+            newType = original.isPresent() ? ModificationType.DELETE : ModificationType.UNMODIFIED;
+            break;
+        default:
+            throw new IllegalStateException("Unhandled deletion of node with " + modificationType);
+        }
+
         clearSnapshot();
-        updateModificationType(ModificationType.DELETE);
         children.clear();
         this.value = null;
+        updateModificationType(newType);
     }
 
     /**
@@ -195,10 +221,28 @@ final class ModifiedNode implements StoreTreeNode<ModifiedNode>, Identifiable<Pa
         this.value = data;
     }
 
+    /**
+     * Seal the modification node and prune any children which has not been
+     * modified.
+     */
     void seal() {
         clearSnapshot();
-        for (ModifiedNode child : children.values()) {
+
+        // Walk all child nodes and remove any children which have not
+        // been modified.
+        final Iterator<ModifiedNode> it = children.values().iterator();
+        while (it.hasNext()) {
+            final ModifiedNode child = it.next();
             child.seal();
+
+            if (child.modificationType == ModificationType.UNMODIFIED) {
+                it.remove();
+            }
+        }
+
+        // A SUBTREE_MODIFIED node without any children is a no-op
+        if (modificationType == ModificationType.SUBTREE_MODIFIED && children.isEmpty()) {
+            updateModificationType(ModificationType.UNMODIFIED);
         }
     }
 
@@ -215,7 +259,6 @@ final class ModifiedNode implements StoreTreeNode<ModifiedNode>, Identifiable<Pa
         return Optional.fromNullable(snapshotCache);
     }
 
-    @GuardedBy("this")
     private void updateModificationType(final ModificationType type) {
         modificationType = type;
         clearSnapshot();
@@ -227,7 +270,7 @@ final class ModifiedNode implements StoreTreeNode<ModifiedNode>, Identifiable<Pa
                 + modificationType + ", childModification=" + children + "]";
     }
 
-    public static ModifiedNode createUnmodified(final TreeNode metadataTree, boolean isOrdered) {
+    public static ModifiedNode createUnmodified(final TreeNode metadataTree, final boolean isOrdered) {
         return new ModifiedNode(metadataTree.getIdentifier(), Optional.of(metadataTree), isOrdered);
     }
 }
index 52aa03eed2be09bd1d526d5f13e56980b0481a12..cd27513ba036d9261990de4c133bc83a140100c9 100644 (file)
@@ -148,10 +148,20 @@ abstract class NormalizedNodeContainerModificationStrategy extends SchemaAwareAp
         final MutableTreeNode newMeta = currentMeta.mutable();
         newMeta.setSubtreeVersion(version);
 
+        /*
+         * The user has issued an empty merge operation. In this case we do not perform
+         * a data tree mutation, do not pass GO, and do not collect useless garbage.
+         */
+        final Iterable<ModifiedNode> children = modification.getChildren();
+        if (Iterables.isEmpty(children)) {
+            newMeta.setData(currentMeta.getData());
+            return newMeta.seal();
+        }
+
         @SuppressWarnings("rawtypes")
         NormalizedNodeContainerBuilder dataBuilder = createBuilder(currentMeta.getData());
 
-        return mutateChildren(newMeta, dataBuilder, version, modification.getChildren());
+        return mutateChildren(newMeta, dataBuilder, version, children);
     }
 
     @Override
index e1df47c7d4df2d20ad65e7caf2860b77726801b0..bcf2101ff07d49572d3cbdb8a92cc3e849dbfc45 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.yangtools.yang.data.impl.schema.tree;
 import com.google.common.base.Optional;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.TreeNode;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.Version;
 
@@ -25,15 +26,31 @@ final class OperationWithModification {
         this.applyOperation = op;
     }
 
-    public OperationWithModification write(final NormalizedNode<?, ?> value) {
+    void write(final NormalizedNode<?, ?> value) {
         modification.write(value);
         applyOperation.verifyStructure(modification);
-        return this;
     }
 
-    public OperationWithModification delete() {
+    private void mergeImpl(final NormalizedNode<?,?> data) {
+        if (data instanceof NormalizedNodeContainer<?,?,?>) {
+            @SuppressWarnings({ "rawtypes", "unchecked" })
+            NormalizedNodeContainer<?,?,NormalizedNode<PathArgument, ?>> dataContainer = (NormalizedNodeContainer) data;
+            for (NormalizedNode<PathArgument, ?> child : dataContainer.getValue()) {
+                PathArgument childId = child.getIdentifier();
+                forChild(childId).mergeImpl(child);
+            }
+        }
+
+        modification.merge(data);
+    }
+
+    void merge(final NormalizedNode<?, ?> data) {
+        mergeImpl(data);
+        applyOperation.verifyStructure(modification);
+    }
+
+    void delete() {
         modification.delete();
-        return this;
     }
 
     public ModifiedNode getModification() {
@@ -51,21 +68,18 @@ final class OperationWithModification {
     public static OperationWithModification from(final ModificationApplyOperation operation,
             final ModifiedNode modification) {
         return new OperationWithModification(operation, modification);
-
-    }
-
-    public void merge(final NormalizedNode<?, ?> data) {
-        modification.merge(data);
-        applyOperation.verifyStructure(modification);
-
     }
 
-    public OperationWithModification forChild(final PathArgument childId) {
+    private OperationWithModification forChild(final PathArgument childId) {
         ModificationApplyOperation childOp = applyOperation.getChild(childId).get();
-        boolean isOrdered = true;
+
+        final boolean isOrdered;
         if (childOp instanceof SchemaAwareApplyOperation) {
             isOrdered = ((SchemaAwareApplyOperation) childOp).isOrdered();
+        } else {
+            isOrdered = true;
         }
+
         ModifiedNode childMod = modification.modifyChild(childId, isOrdered);
 
         return from(childOp,childMod);
index d7aa826c236f4c375ca9e1bd6c3dccf3f5dd7d42..85ed74f208e6b44ce8cb4613ea0729e8bd022a92 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.yangtools.yang.data.impl.schema.tree;
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Iterables;
+import java.util.List;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
@@ -39,8 +40,6 @@ import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.List;
-
 abstract class SchemaAwareApplyOperation implements ModificationApplyOperation {
     private static final Logger LOG = LoggerFactory.getLogger(SchemaAwareApplyOperation.class);
 
@@ -209,10 +208,16 @@ abstract class SchemaAwareApplyOperation implements ModificationApplyOperation {
             return modification.storeSnapshot(Optional.of(applySubtreeChange(modification, currentMeta.get(),
                     version)));
         case MERGE:
-            if(currentMeta.isPresent()) {
-                return modification.storeSnapshot(Optional.of(applyMerge(modification,currentMeta.get(), version)));
+            final TreeNode result;
+
+            // This is a slight optimization: a merge on a non-existing node equals to a write
+            if (currentMeta.isPresent()) {
+                result = applyMerge(modification,currentMeta.get(), version);
+            } else {
+                result = applyWrite(modification, currentMeta, version);
             }
-            // intentional fall-through: if the node does not exist a merge is same as a write
+
+            return modification.storeSnapshot(Optional.of(result));
         case WRITE:
             return modification.storeSnapshot(Optional.of(applyWrite(modification, currentMeta, version)));
         case UNMODIFIED:
index 33681c08d721ec165f664848fab69f41b9564a26..ef97c5d4ad9dfb50ea7bfad0eacc33475087aedb 100644 (file)
@@ -53,8 +53,9 @@ final class OperationStack {
     }
 
     private ModifyAction getOperation(NormalizedNode<?, ?> modificationNode) {
-        if (!(modificationNode instanceof AttributesContainer))
+        if (!(modificationNode instanceof AttributesContainer)) {
             return null;
+        }
 
         String operationString = ((AttributesContainer) modificationNode).getAttributes().get(OPERATION_NAME);
 
index f9019abcb5a06cf887df90c92be42e1bdaf8b148..98fe8694db6ae04a68dd16429e566df850134b12 100644 (file)
@@ -255,29 +255,34 @@ public final class SchemaContextUtil {
         Iterable<QName> nextPath = nextLevel(path);
 
         foundNode = module.getDataChildByName(current);
-        if (foundNode != null && nextPath.iterator().hasNext())
+        if (foundNode != null && nextPath.iterator().hasNext()) {
             foundNode = findNodeIn(foundNode, nextPath);
+        }
 
         if (foundNode == null) {
             foundNode = getGroupingByName(module, current);
-            if (foundNode != null && nextPath.iterator().hasNext())
+            if (foundNode != null && nextPath.iterator().hasNext()) {
                 foundNode = findNodeIn(foundNode, nextPath);
+            }
         }
 
         if (foundNode == null) {
             foundNode = getRpcByName(module, current);
-            if (foundNode != null && nextPath.iterator().hasNext())
+            if (foundNode != null && nextPath.iterator().hasNext()) {
                 foundNode = findNodeIn(foundNode, nextPath);
+            }
         }
 
         if (foundNode == null) {
             foundNode = getNotificationByName(module, current);
-            if (foundNode != null && nextPath.iterator().hasNext())
+            if (foundNode != null && nextPath.iterator().hasNext()) {
                 foundNode = findNodeIn(foundNode, nextPath);
+            }
         }
 
-        if (foundNode == null)
+        if (foundNode == null) {
             LOG.debug("No node matching {} found in node {}", path, module);
+        }
 
         return foundNode;
 
@@ -303,13 +308,15 @@ public final class SchemaContextUtil {
             DataNodeContainer parentDataNodeContainer = (DataNodeContainer) parent;
 
             foundNode = parentDataNodeContainer.getDataChildByName(current);
-            if (foundNode != null && nextPath.iterator().hasNext())
+            if (foundNode != null && nextPath.iterator().hasNext()) {
                 foundNode = findNodeIn(foundNode, nextPath);
+            }
 
             if (foundNode == null) {
                 foundNode = getGroupingByName(parentDataNodeContainer, current);
-                if (foundNode != null && nextPath.iterator().hasNext())
+                if (foundNode != null && nextPath.iterator().hasNext()) {
                     foundNode = findNodeIn(foundNode, nextPath);
+                }
             }
         }
 
@@ -318,31 +325,36 @@ public final class SchemaContextUtil {
 
             if (current.getLocalName().equals("input")) {
                 foundNode = parentRpcDefinition.getInput();
-                if (foundNode != null && nextPath.iterator().hasNext())
+                if (foundNode != null && nextPath.iterator().hasNext()) {
                     foundNode = findNodeIn(foundNode, nextPath);
+                }
             }
 
             if (current.getLocalName().equals("output")) {
                 foundNode = parentRpcDefinition.getOutput();
-                if (foundNode != null && nextPath.iterator().hasNext())
+                if (foundNode != null && nextPath.iterator().hasNext()) {
                     foundNode = findNodeIn(foundNode, nextPath);
+                }
             }
 
             if (foundNode == null) {
                 foundNode = getGroupingByName(parentRpcDefinition, current);
-                if (foundNode != null && nextPath.iterator().hasNext())
+                if (foundNode != null && nextPath.iterator().hasNext()) {
                     foundNode = findNodeIn(foundNode, nextPath);
+                }
             }
         }
 
         if (foundNode == null && parent instanceof ChoiceNode) {
             foundNode = ((ChoiceNode) parent).getCaseNodeByName(current);
-            if (foundNode != null && nextPath.iterator().hasNext())
+            if (foundNode != null && nextPath.iterator().hasNext()) {
                 foundNode = findNodeIn(foundNode, nextPath);
+            }
         }
 
-        if (foundNode == null)
+        if (foundNode == null) {
             LOG.debug("No node matching {} found in node {}", path, parent);
+        }
 
         return foundNode;
 
index f31909725ca829b6e56d38d6009de4f2e5e967d9..ce9ccc2cc0dbd8c8ce40e0e8c0d72fdaf686c6bf 100644 (file)
@@ -65,8 +65,9 @@ public final class UsesNodeBuilderImpl extends AbstractBuilder implements UsesNo
         // AUGMENTATIONS
         final Set<AugmentationSchema> augments = new HashSet<>();
         for (AugmentationSchemaBuilder builder : augmentationBuilders) {
-            if (!builder.isUnsupportedTarget())
+            if (!builder.isUnsupportedTarget()) {
                 augments.add(builder.build());
+            }
         }
         instance.augmentations = ImmutableSet.copyOf(augments);