lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r1075079 - in /lucene/dev/trunk/solr/src: common/org/apache/solr/common/util/SystemIdResolver.java test-files/solr/conf/solrconfig-xinclude.xml
Date Sun, 27 Feb 2011 15:40:58 GMT
Author: uschindler
Date: Sun Feb 27 15:40:57 2011
New Revision: 1075079

URL: http://svn.apache.org/viewvc?rev=1075079&view=rev
Log:
SOLR-1656: Fix XInclude xi:fallback by throwing IOException instead of RuntimeException from
ResourceLoader

Modified:
    lucene/dev/trunk/solr/src/common/org/apache/solr/common/util/SystemIdResolver.java
    lucene/dev/trunk/solr/src/test-files/solr/conf/solrconfig-xinclude.xml

Modified: lucene/dev/trunk/solr/src/common/org/apache/solr/common/util/SystemIdResolver.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/common/org/apache/solr/common/util/SystemIdResolver.java?rev=1075079&r1=1075078&r2=1075079&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/common/org/apache/solr/common/util/SystemIdResolver.java (original)
+++ lucene/dev/trunk/solr/src/common/org/apache/solr/common/util/SystemIdResolver.java Sun
Feb 27 15:40:57 2011
@@ -133,10 +133,15 @@ public final class SystemIdResolver impl
         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;

Modified: lucene/dev/trunk/solr/src/test-files/solr/conf/solrconfig-xinclude.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test-files/solr/conf/solrconfig-xinclude.xml?rev=1075079&r1=1075078&r2=1075079&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test-files/solr/conf/solrconfig-xinclude.xml (original)
+++ lucene/dev/trunk/solr/src/test-files/solr/conf/solrconfig-xinclude.xml Sun Feb 27 15:40:57
2011
@@ -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>



Mime
View raw message