Uploaded image for project: 'WS-Commons'
  1. WS-Commons
  2. WSCOMMONS-365

schema files with the same namespace throw exception

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • XmlSchema 1.4.3
    • XmlSchema
    • 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);

      Attachments

        Activity

          People

            Unassigned Unassigned
            a_ilyin@yahoo.com Alexander Ilyin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: