fix to resource handling in PluggableSchemaResolver
This commit is contained in:
parent
6651ff0c55
commit
ae461db82a
|
@ -17,6 +17,7 @@
|
|||
package org.springframework.beans.factory.xml;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
@ -99,16 +100,17 @@ public class PluggableSchemaResolver implements EntityResolver {
|
|||
this.schemaMappingsLocation = schemaMappingsLocation;
|
||||
}
|
||||
|
||||
|
||||
public InputSource resolveEntity(String publicId, String systemId) throws IOException {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Trying to resolve XML entity with public id [" + publicId +
|
||||
"] and system id [" + systemId + "]");
|
||||
}
|
||||
|
||||
if (systemId != null) {
|
||||
String resourceLocation = getSchemaMappings().get(systemId);
|
||||
if (resourceLocation != null) {
|
||||
Resource resource = new ClassPathResource(resourceLocation, this.classLoader);
|
||||
try {
|
||||
InputSource source = new InputSource(resource.getInputStream());
|
||||
source.setPublicId(publicId);
|
||||
source.setSystemId(systemId);
|
||||
|
@ -117,6 +119,12 @@ public class PluggableSchemaResolver implements EntityResolver {
|
|||
}
|
||||
return source;
|
||||
}
|
||||
catch (FileNotFoundException ex) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Couldn't find XML schema [" + systemId + "]: " + resource, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue