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 ab7255b3f09a83049d23b028964ab2a8d0969d34..aa24ee6c832837e59b7f2fe8670fc7f82dfdc2ba 100644 (file)
@@ -474,7 +474,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
@@ -491,7 +491,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()) {
@@ -517,7 +518,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,