Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
Eclipse
Description
XmlSchemaCollection couldn't add the schema when other one was already added and had the same namespace.
It happened because the uniqueness of some schema is calculated by it's namespace and systemId. systemId is calculated from the getSystemId() of the underlying InputSource.
In case getSystemId() returns null the exception will be thrown (which is happened in my case because my schema is read from the eclipse bundle)
When method resolveXmlSchema is creating the SchemaKey for checking the uniqueness of the schema it does right by calculating the systemId with:
final String systemId = source.getSystemId() == null ? schemaLocation
: source.getSystemId();
But when it has determined the schema had to be read it will fail. In the method XmlSchemaCollection.read just called
return read(doc, inputSource.getSystemId(), veh, namespaceValidator);
But inputSource.getSystemId() equals null and it's found previously registered another schema with the same key where systemId was improperly assigned as null.
I think you need to change the read method like below:
return read(doc, source.getSystemId() == null ? schemaLocation : source.getSystemId(), veh, namespaceValidator);