NullPointerException in NamespaceMap.getNamespaceURI() method
-------------------------------------------------------------
Key: XMLSCHEMA-13
URL: https://issues.apache.org/jira/browse/XMLSCHEMA-13
Project: XmlSchema
Issue Type: Bug
Affects Versions: XmlSchema 2.0
Reporter: Dmitry Repchevsky
The method uses toString() without checking whether namespace exists for the
prefix
public String getNamespaceURI(String prefix) {
return get(prefix).toString();
}
should be:
public String getNamespaceURI(String prefix) {
String namespaceURI = get(prefix);
return namespaceURI == null ? null : namespaceURI .toString();
}
the latter fix would allow a correct behavior for the next code found in
XmlSchemaSerializer:
if (ctx != null && ctx.getNamespaceURI(xsdPrefix) != null) {
xsdPrefix = "xsd";
}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]