avoid classloading issues within Wildfly; see https://developer.jboss.org/thread/80291

This commit is contained in:
Ulrich Zielhofer
2020-10-30 13:41:13 +01:00
parent dd17a2b5b9
commit 7a4c4afc9b

View File

@@ -56,7 +56,7 @@ public abstract class Validator {
* @throws IrrecoverableValidationError when any fatal errors arise, e.g. when the source file can not be found * @throws IrrecoverableValidationError when any fatal errors arise, e.g. when the source file can not be found
*/ */
protected void validateSchema(byte[] xmlRawData, String schemaPath, int section, EPart part) throws IrrecoverableValidationError { protected void validateSchema(byte[] xmlRawData, String schemaPath, int section, EPart part) throws IrrecoverableValidationError {
URL schemaFile = ClassLoader.getSystemResource("schema/" + schemaPath); URL schemaFile = Thread.currentThread().getContextClassLoader().getResource("schema/" + schemaPath);
Source xmlData = new StreamSource(new ByteArrayInputStream(xmlRawData)); Source xmlData = new StreamSource(new ByteArrayInputStream(xmlRawData));
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
try { try {