public synchronized void setSchemaContext(final SchemaContext newSchemaContext) {
Preconditions.checkNotNull(newSchemaContext);
- LOG.info("Attepting to install schema context {}", newSchemaContext);
+ LOG.info("Attempting to install schema context {}", newSchemaContext);
/*
* FIXME: we should walk the schema contexts, both current and new and see
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
+import com.google.common.collect.Iterables;
import java.util.AbstractMap.SimpleEntry;
-import java.util.ArrayList;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
public static <T extends StoreTreeNode<T>> T findNodeChecked(final T tree, final InstanceIdentifier path) {
T current = tree;
- List<PathArgument> nested = new ArrayList<>(path.getPath().size());
+
+ int i = 1;
for(PathArgument pathArg : path.getPathArguments()) {
Optional<T> potential = current.getChild(pathArg);
- nested.add(pathArg);
- Preconditions.checkArgument(potential.isPresent(),"Child %s is not present in tree.",nested);
+ if (!potential.isPresent()) {
+ throw new IllegalArgumentException(String.format("Child %s is not present in tree.",
+ Iterables.toString(Iterables.limit(path.getPathArguments(), i))));
+ }
current = potential.get();
+ ++i;
}
return current;
}