Check Notification name match 54/106454/3
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 12 Jun 2023 16:08:41 +0000 (18:08 +0200)
committerRobert Varga <nite@hq.sk>
Mon, 12 Jun 2023 17:19:50 +0000 (17:19 +0000)
When we are faking the root Notification node, we should also be making
sure we actually match on QName.

Change-Id: Ifbe289b7326dae6a522659d7c6378785dd2ae0ec
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
codec/yang-data-codec-xml/src/main/java/org/opendaylight/yangtools/yang/data/codec/xml/SchemaAwareXMLStreamNormalizedNodeStreamWriter.java
data/yang-data-util/src/main/java/org/opendaylight/yangtools/yang/data/util/NormalizedNodeStreamWriterStack.java

index 594e7fb068d0aaf7e6df2a7df0a8065d6762487c..6168b96abb560c6860217829234beaea645563b1 100644 (file)
@@ -120,8 +120,8 @@ final class SchemaAwareXMLStreamNormalizedNodeStreamWriter
 
     @Override
     public void startContainerNode(final NodeIdentifier name, final int childSizeHint) throws IOException {
-        final var schema = tracker.startContainerNode(name);
-        startElement(schema.getQName());
+        tracker.startContainerNode(name);
+        startElement(name.getNodeType());
     }
 
     @Override
index 58e078a5e848840c25345878e3178bb0eec994b0..72547fe4285f769da454aa2bd8dc5ff476bb805b 100644 (file)
@@ -254,7 +254,8 @@ public final class NormalizedNodeStreamWriterStack implements LeafrefResolver {
         LOG.debug("Enter container {}", name);
 
         final ContainerLike schema;
-        if (schemaStack.isEmpty() && root instanceof NotificationDefinition notification) {
+        if (schemaStack.isEmpty() && root instanceof NotificationDefinition notification
+            && name.getNodeType().equals(notification.getQName())) {
             // Special case for stacks initialized at notification. We pretend the first container is contained within
             // itself.
             // FIXME: 8.0.0: factor this special case out to something more reasonable, like being initialized at the