Ditch use of RpcDefintion.getOutput().getPath() 14/100214/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 22 Mar 2022 08:57:05 +0000 (09:57 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 22 Mar 2022 08:57:27 +0000 (09:57 +0100)
This does not solve much, but reduces clutter a bit.

JIRA: NETCONF-818
Change-Id: I2028703449459f1fac7ee8774dd26125420b7308
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/NormalizedNodeJsonBodyWriter.java
restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/NormalizedNodeXmlBodyWriter.java

index a797215ac3f411638b39af4f2b03a8a70253ff1a..50ca47bbd4e9db2e08c73f81566d9725a532de1d 100644 (file)
@@ -128,7 +128,8 @@ public class NormalizedNodeJsonBodyWriter implements MessageBodyWriter<Normalize
              *  RpcDefinition is not supported as initial codec in JSONStreamWriter,
              *  so we need to emit initial output declaratation..
              */
-            path = ((RpcDefinition) context.getSchemaNode()).getOutput().getPath();
+            final var rpc = (RpcDefinition) context.getSchemaNode();
+            path = SchemaPath.create(true, rpc.getQName(), rpc.getOutput().getQName());
             nnWriter = createNormalizedNodeWriter(context, path, jsonWriter, depth);
             jsonWriter.name("output");
             jsonWriter.beginObject();
index 39eecad79c1955c7d2c9e39ec90dfb92f33dcd4b..ea559b9b5ec131fdc551aad014ded49f55a48f7a 100644 (file)
@@ -127,8 +127,9 @@ public class NormalizedNodeXmlBodyWriter implements MessageBodyWriter<Normalized
                 writeElements(xmlWriter, nnWriter, (ContainerNode) data);
             }
         }  else if (pathContext.getSchemaNode() instanceof RpcDefinition) {
+            final var rpc = (RpcDefinition) pathContext.getSchemaNode();
             nnWriter = createNormalizedNodeWriter(xmlWriter, schemaCtx,
-                    ((RpcDefinition) pathContext.getSchemaNode()).getOutput().getPath(), depth);
+                    SchemaPath.create(true, rpc.getQName(), rpc.getOutput().getQName()), depth);
             writeElements(xmlWriter, nnWriter, (ContainerNode) data);
         } else {
             nnWriter = createNormalizedNodeWriter(xmlWriter, schemaCtx, schemaPath.getParent(), depth);