Uploaded image for project: 'yangtools'
  1. yangtools
  2. YANGTOOLS-1575

JSONNormalizedNodeStreamWriter fails to process MapEntryNode

XMLWordPrintable

      the issue:

      Caused by: java.lang.IllegalArgumentException: List item is not appropriate
          at org.opendaylight.yangtools.yang.data.util.NormalizedNodeStreamWriterStack.startListItem(NormalizedNodeStreamWriterStack.java:212)
          at org.opendaylight.yangtools.yang.data.codec.gson.JSONNormalizedNodeStreamWriter.startMapEntryNode(JSONNormalizedNodeStreamWriter.java:369)
          at org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter$OrderedNormalizedNodeWriter.writeMapEntryNode(NormalizedNodeWriter.java:223)
          at org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter.wasProcessedAsCompositeNode(NormalizedNodeWriter.java:187)
          at org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter.write(NormalizedNodeWriter.java:99)

      How to replicate:

      Build this patch using mvn clean install -DskipTests
      https://github.com/PANTHEONtech/lighty/pull/1866

      run this test: io.lighty.gnmi.southbound.mountpoint.codecs.YangInstanceNormToGnmiUpdateCodecTest#listEntryCase

      The test will fail because of this patch:
      https://github.com/opendaylight/yangtools/commit/8f5f0782ffb25f903946d23816b199bdfb41fcda#diff-00182c1c04f65edb6227acbbd29252a3151b9a46f97dd7be0272e69b937dc090L173

      The patch made a change that the getParent() could not return root if schemaStack.peek() is null.
      This then causes failure in here, because it returns null:
      https://github.com/opendaylight/yangtools/blob/master/data/yang-data-util/src/main/java/org/opendaylight/yangtools/yang/data/util/NormalizedNodeStreamWriterStack.java#L212

            tobias.pobocik Tobias Pobocik
            tobias.pobocik Tobias Pobocik
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: