Use findTargetNode() in findDataSchemaNode() 13/86613/1
authorRobert Varga <robert.varga@pantheon.tech>
Sun, 29 Dec 2019 08:47:18 +0000 (09:47 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Sun, 29 Dec 2019 09:30:27 +0000 (10:30 +0100)
This removes a bit of duplication by sharing the code path with
relative resolver.

Change-Id: Icb619aca8d87ade490066fd8c6abe0d2a96dec96
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 57a7f87c3115454aba47299d797da48a1227c9b2)

yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/SchemaContextUtil.java

index b8ffe379da7b5b37211de4c13a8f7a741a43796f..306015fc25fbcac9bb53c3ee1af253d19bdb5ecd 100644 (file)
@@ -156,12 +156,7 @@ public final class SchemaContextUtil {
         final String strXPath = nonCondXPath.getOriginalString();
         checkArgument(strXPath.indexOf('[') == -1, "Revision Aware XPath may not contain a condition");
         if (nonCondXPath.isAbsolute()) {
-            final List<QName> path = xpathToQNamePath(context, module, strXPath);
-
-            // We do not have enough information about resolution context, hence cannot account for actions, RPCs
-            // and notifications. We therefore attempt to make a best estimate, but this can still fail.
-            final Optional<DataSchemaNode> pureData = context.findDataTreeChild(path);
-            return pureData.isPresent() ? pureData.get() : findNodeInSchemaContext(context, path);
+            return findTargetNode(context, xpathToQNamePath(context, module, strXPath));
         }
         return null;
     }