Fix missing location in error reports
[yangtools.git] / yang / yang-data-codec-xml / src / main / java / org / opendaylight / yangtools / yang / data / codec / xml / XmlParserStream.java
index 0baabbb64ca0ee2740b4cd6daa101ffc75808b7e..5c3d7e3735b2fb0b64c919fb094d6855c002f20f 100644 (file)
@@ -439,7 +439,7 @@ public final class XmlParserStream implements Closeable, Flushable {
 
         switch (in.nextTag()) {
             case XMLStreamConstants.START_ELEMENT:
-                // FIXME: 6.0.0: why do we even need this tracker? either document it or remove it.
+                // FIXME: 7.0.0: why do we even need this tracker? either document it or remove it.
                 //               it looks like it is a crude duplicate finder, which should really be handled via
                 //               ChildReusePolicy.REJECT
                 final Set<Entry<String, String>> namesakes = new HashSet<>();
@@ -487,7 +487,7 @@ public final class XmlParserStream implements Closeable, Flushable {
                         if (!added && !elementList) {
                             throw new XMLStreamException(String.format(
                                 "Duplicate element \"%s\" in namespace \"%s\" with parent \"%s\" in XML input",
-                                xmlElementName, elementNS, parent.getSchema()), in.getLocation());
+                                xmlElementName, elementNS, parentSchema), in.getLocation());
                         }
 
                         // We have a match, proceed with it
@@ -504,7 +504,8 @@ public final class XmlParserStream implements Closeable, Flushable {
                         } else if (parentSchema instanceof ListSchemaNode) {
                             optMount = MountPointSchemaNode.streamAll((ListSchemaNode) parentSchema).findFirst();
                         } else {
-                            throw new XMLStreamException("Unhandled mount-aware schema " + parentSchema);
+                            throw new XMLStreamException("Unhandled mount-aware schema " + parentSchema,
+                                in.getLocation());
                         }
 
                         if (optMount.isPresent()) {
@@ -530,7 +531,7 @@ public final class XmlParserStream implements Closeable, Flushable {
                     if (strictParsing) {
                         throw new XMLStreamException(String.format(
                             "Schema for node with name %s and namespace %s does not exist at %s", xmlElementName,
-                            elementNS, parentSchema.getPath(), in.getLocation()));
+                            elementNS, parentSchema.getPath()), in.getLocation());
                     }
 
                     LOG.debug("Skipping unknown node ns=\"{}\" localName=\"{}\" at path {}", elementNS, xmlElementName,