Details
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..
Any chances for supplying me with a patch in form of a unified diff ?