Dump the modification which fails to produce a root node 55/18855/4
authorRobert Varga <rovarga@cisco.com>
Wed, 22 Apr 2015 15:32:47 +0000 (17:32 +0200)
committerRobert Varga <rovarga@cisco.com>
Thu, 23 Apr 2015 12:59:22 +0000 (14:59 +0200)
For CDS implementation, there seems to be a bug where we fail to create
an appropriate changeset. Also be sure to send debug on how the
candidate is being applied.

Change-Id: Ie0eccd831169ff42c002851633926713dba20c74
Signed-off-by: Robert Varga <rovarga@cisco.com>
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/DataTreeCandidates.java
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/AbstractDataTreeTip.java

index 441f92776373383156f78479ff9838a91e578cc1..04e3b204bcbc12f7ae3ab795bb558810e066559b 100644 (file)
@@ -10,12 +10,15 @@ package org.opendaylight.yangtools.yang.data.api.schema.tree;
 import com.google.common.annotations.Beta;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Utility class holding methods useful when dealing with {@link DataTreeCandidate} instances.
  */
 @Beta
 public final class DataTreeCandidates {
+    private static final Logger LOG = LoggerFactory.getLogger(DataTreeCandidates.class);
     private DataTreeCandidates() {
         throw new UnsupportedOperationException();
     }
@@ -36,17 +39,21 @@ public final class DataTreeCandidates {
         switch (node.getModificationType()) {
         case DELETE:
             modification.delete(path);
+            LOG.debug("Modification {} deleted path {}", modification, path);
             break;
         case SUBTREE_MODIFIED:
+            LOG.debug("Modification {} modified path {}", modification, path);
             for (DataTreeCandidateNode child : node.getChildNodes()) {
                 applyNode(modification, path.node(child.getIdentifier()), child);
             }
             break;
         case UNMODIFIED:
+            LOG.debug("Modification {} unmodified path {}", modification, path);
             // No-op
             break;
         case WRITE:
             modification.write(path, node.getDataAfter().get());
+            LOG.debug("Modification {} written path {}", modification, path);
             break;
         default:
             throw new IllegalArgumentException("Unsupported modification " + node.getModificationType());
index b2b132d1369485d14f6585afdeaf7d2f1d46a96b..9b1ef2d2ef50148aacbf47488c95ae4f718fe0d0 100644 (file)
@@ -51,7 +51,7 @@ abstract class AbstractDataTreeTip implements DataTreeTip {
 
         final Optional<TreeNode> newRoot = m.getStrategy().apply(m.getRootModification(),
             Optional.<TreeNode>of(currentRoot), m.getVersion());
-        Preconditions.checkState(newRoot.isPresent(), "Apply strategy failed to produce root node");
+        Preconditions.checkState(newRoot.isPresent(), "Apply strategy failed to produce root node for modification %s", modification);
         return new InMemoryDataTreeCandidate(PUBLIC_ROOT_PATH, root, currentRoot, newRoot.get());
     }
 }