if (schemaBytes == null) {
synchronized (schemaCache) {
String schemaPath = catalog.get(namespaceURI);
if (schemaPath == null) {
throw new SmooksConfigurationException("Unknown EDI namespace '" + namespaceURI + "'.");
}
InputStream schemaStream = ClassUtil.getResourceAsStream(schemaPath, EclipseFragmentXMLValidator.class);
if (schemaStream == null) {
throw new SmooksConfigurationException("Unable to locate XSD classpath resource '" + schemaPath + "' for EDI namespace '" + namespaceURI + "'.");
}
try {
schemaBytes = new ByteArrayInputStream(StreamUtils.readStream(schemaStream));
schemaCache.put(namespaceURI, schemaBytes);
} catch (IOException e) {
throw new SmooksConfigurationException("Unable to read XSD classpath resource '" + schemaPath + "' for EDI namespace '" + namespaceURI + "'.");
} finally {
try {
schemaStream.close();
} catch (IOException e) {
logger.debug("Unexpected exception classing classpath resource stream for '" + schemaPath + "'.", e);