castor
  1. castor
  2. CASTOR-1935

Importing from same namespace multiple times where one import actually includes the other fails

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0
    • Fix Version/s: 1.1.1
    • Component/s: XML
    • Labels:
      None
    • Testcase included:
      yes
    • Number of attachments :
      2

      Description

      If a schema imports multiple schemas from the same namespace:

      <xs:import namespace="urn:acme.com:test:schemas" schemaLocation="PersonsA.xsd"/>
      <xs:import namespace="urn:acme.com:test:schemas" schemaLocation="PersonsB.xsd"/>

      Then the results are merged per code in the ImportUnmarshaller:

      //-- check schema location, if different, allow merge
      if (hasLocation)

      { String tmpLocation = importedSchema.getSchemaLocation(); alreadyLoaded = schemaLocation.equals(tmpLocation); }

      However if in this case PersonsB imports PersonsA. What happens is that you get an error when processing the type info from PersonsA a second time saying the info is already there.

      The fix is to do the following:
      //-- check schema location, if different, allow merge
      if (hasLocation)

      { String tmpLocation = importedSchema.getSchemaLocation(); alreadyLoaded = schemaLocation.equals(tmpLocation) || importedSchema.includeProcessed(schemaLocation); //-- keep track of the original schemaLocation as an include if(! alreadyLoaded) importedSchema.addInclude(tmpLocation); }

      Note this is related to bug CASTOR-711, which actually appears fixed, but not for this case..

        Activity

          People

          • Assignee:
            Werner Guttmann
            Reporter:
            Chris Keller
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: