// 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
// FIXME: We need to trigger the loading of the enclosing WSDL models
return;
}
// Read an XSD document
InputSource xsd;
try {
xsd = XMLDocumentHelper.getInputSource(definition.getLocation().toURL());
} catch (IOException e) {
throw new ContributionRuntimeException(e);
}
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);
}
}