X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=yang%2Fyang-data-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fyang%2Fdata%2Futil%2FDataSchemaContextNode.java;h=336ab56e942aa3857dd8a36267d0244f449def52;hb=1cb3b70ea959108d66dd19cbe30c86d78c77e5c9;hp=07ce69fff6a509f3ee4c51edd726fc70bfe33ef5;hpb=b084ee60e84a41e854018599d36719b4200b231d;p=yangtools.git diff --git a/yang/yang-data-util/src/main/java/org/opendaylight/yangtools/yang/data/util/DataSchemaContextNode.java b/yang/yang-data-util/src/main/java/org/opendaylight/yangtools/yang/data/util/DataSchemaContextNode.java index 07ce69fff6..336ab56e94 100644 --- a/yang/yang-data-util/src/main/java/org/opendaylight/yangtools/yang/data/util/DataSchemaContextNode.java +++ b/yang/yang-data-util/src/main/java/org/opendaylight/yangtools/yang/data/util/DataSchemaContextNode.java @@ -97,23 +97,23 @@ public abstract class DataSchemaContextNode implements I static DataSchemaContextNode fromSchemaAndQNameChecked(final DataNodeContainer schema, final QName child) { DataSchemaNode result = findChildSchemaNode(schema, child); // We try to look up if this node was added by augmentation - if (result != null && (schema instanceof DataSchemaNode) && result.isAugmenting()) { + if (result != null && schema instanceof DataSchemaNode && result.isAugmenting()) { return fromAugmentation(schema, (AugmentationTarget) schema, result); } return fromDataSchemaNode(result); } + // FIXME: this looks like it should be a Predicate on a stream with findFirst() private static ChoiceSchemaNode findChoice(final Iterable choices, final QName child) { - ChoiceSchemaNode foundChoice = null; - choiceLoop: for (ChoiceSchemaNode choice : choices) { - for (ChoiceCaseNode caze : choice.getCases()) { + for (ChoiceSchemaNode choice : choices) { + // FIXME: this looks weird: what are we looking for again? + for (ChoiceCaseNode caze : choice.getCases().values()) { if (findChildSchemaNode(caze, child) != null) { - foundChoice = choice; - break choiceLoop; + return choice; } } } - return foundChoice; + return null; } public static AugmentationIdentifier augmentationIdentifierFrom(final AugmentationSchemaNode augmentation) {