mirror of https://github.com/apache/lucene.git
SOLR-1656: Fix XInclude xi:fallback by throwing IOException instead of RuntimeException from ResourceLoader
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1075079 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
638767c9ac
commit
d45074306e
|
@ -133,10 +133,15 @@ public final class SystemIdResolver implements EntityResolver, EntityResolver2 {
|
|||
if (!RESOURCE_LOADER_AUTHORITY_ABSOLUTE.equals(authority)) {
|
||||
path = path.substring(1);
|
||||
}
|
||||
final InputSource is = new InputSource(loader.openResource(path));
|
||||
is.setSystemId(uri.toASCIIString());
|
||||
is.setPublicId(publicId);
|
||||
return is;
|
||||
try {
|
||||
final InputSource is = new InputSource(loader.openResource(path));
|
||||
is.setSystemId(uri.toASCIIString());
|
||||
is.setPublicId(publicId);
|
||||
return is;
|
||||
} catch (RuntimeException re) {
|
||||
// unfortunately XInclude fallback only works with IOException, but openResource() never throws that one
|
||||
throw (IOException) (new IOException(re.getMessage()).initCause(re));
|
||||
}
|
||||
} else {
|
||||
// resolve all other URIs using the standard resolver
|
||||
return null;
|
||||
|
|
|
@ -20,5 +20,9 @@
|
|||
<config>
|
||||
<luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
|
||||
|
||||
<xi:include href="solrconfig-reqHandler.incl" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="foobar-missing.xml" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<xi:fallback>
|
||||
<xi:include href="solrconfig-reqHandler.incl" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
</xi:fallback>
|
||||
</xi:include>
|
||||
</config>
|
||||
|
|
Loading…
Reference in New Issue