// find original cause of the problem
Throwable cause = e;
while (cause.getCause() != null) {
cause = cause.getCause();
}
throw new ContributionRuntimeException(cause);
}
definition.setSchemaCollection(schemaCollection);
definition.setSchema(schema);
definition.setUnresolved(false);
} else if (definition.getLocation() != null) {
if (definition.getLocation().getFragment() != null) {
// It's an inline schema
return;
}
// Read an XSD document
InputSource xsd = XMLDocumentHelper.getInputSource(definition.getLocation().toURL());
for (XmlSchema d : schemaCollection.getXmlSchemas()) {
if (isSameNamespace(d.getTargetNamespace(), definition.getNamespace())) {
if (d.getSourceURI().equals(definition.getLocation().toString()))
return;
}
}
XmlSchema schema = null;
try {
schema = schemaCollection.read(xsd, null);
} catch (RuntimeException e) {
// find original cause of the problem
Throwable cause = e;
while (cause.getCause() != null) {
cause = cause.getCause();
}
throw new ContributionRuntimeException(cause);
}
definition.setSchemaCollection(schemaCollection);
definition.setSchema(schema);
}
}