schema files with the same namespace throw exception
----------------------------------------------------

                 Key: WSCOMMONS-365
                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-365
             Project: WS-Commons
          Issue Type: Bug
          Components: XmlSchema
         Environment: Eclipse
            Reporter: Alexander Ilyin


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);  




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to