try {
reader = xmlFactory.createXMLStreamReader(is);
try {
reader.nextTag();
if (!AssemblyConstants.COMPONENT_TYPE.equals(reader.getName())) {
InvalidRootElementException e = new InvalidRootElementException(AssemblyConstants.COMPONENT_TYPE, reader.getName());
e.setResourceURI(componentTypeFile.toString());
throw e;
}
return (ComponentType) registry.load(reader, loaderContext);
} finally {
try {
reader.close();
} catch (XMLStreamException e) {
// ignore
}
}
} finally {
try {
is.close();
} catch (IOException e) {
// ignore
}
}
} catch (IOException e) {
SidefileLoadException sfe = new SidefileLoadException(e.getMessage());
sfe.setResourceURI(componentTypeFile.toString());
throw sfe;
} catch (XMLStreamException e) {
SidefileLoadException sfe = new SidefileLoadException(e.getMessage());
sfe.setResourceURI(componentTypeFile.toString());
throw sfe;
} catch (ConfigurationLoadException e) {
SidefileLoadException sfe = new SidefileLoadException(e.getMessage());
sfe.setResourceURI(componentTypeFile.toString());
throw sfe;
}
}