lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler (JIRA)" <>
Subject [jira] Commented: (SOLR-1656) XInclude's are resolved relative CWD, not instance dir
Date Wed, 23 Feb 2011 19:05:38 GMT


Uwe Schindler commented on SOLR-1656:

This path at least fixes the CWD problem in an non-intrusive way using a interface hack. I
think that's perfectly fine to preserve the SystemID along with the InputStream.

Problem is that the XML handling is a little bit inconsistent, because it currently only work
for files and only if the files are in exact same directory. Theoretically, it *should* be
possible that a XML file that is in the conf folder (which is part of the classpath) can load
a file from the lib folder (which is also part of the resource classpath and should work with
a relative filename only path) or even from inside a JAR file (if the java package name ==
classpath directory is identical).

This could only be solved by e.g. supplying a method RessourceLoader.asFooBarResolver that
returns a class that implements both org.xml.sax.EntityResolver, javax.xml.transform.URIResolver
(to work with either SAX and TRAX) and delegates all requests to the underlying classloader.
Example could be taken from []
(warning: this example is not correct, but goes into right direction).

Another solution might be to not pass streams around, but simply feed the xml parser with
the URL.toString() returned by ClassLoader.getResource(). This would also work with JAR files
(I use this quite often in my code to parse XSL or other XML files in the JAR file of my programs):

final URL url=MyClass.class.getResource("myXSLTFile.xslt");
if (url == null) throw new FileNotFoundException();
final Templates templates = transformerFactory.newTemplates(new StreamSource(t.toString()));

This would also successfully load relative resources, but not accross JAR files or different
dirs (so "./anyfile.xml" would only find the file if its in same java package in same JAR
files but not if the file is in a different JAR file or other classpath entry in same package).

> XInclude's are resolved relative CWD, not instance dir
> ------------------------------------------------------
>                 Key: SOLR-1656
>                 URL:
>             Project: Solr
>          Issue Type: Bug
>    Affects Versions: 1.4
>            Reporter: Hoss Man
>         Attachments: SOLR-1656_Support_SAX_SystemId_via_wrapping_InputStream.patch, Support_SAX_SystemId_via_wrapping_InputStream.patch
> As noted on the mailing list, when an XInclude in a config files refrences a relative
path, it's resolved relative the CWD of the servlet container, and not the instanceDir of
the core...

This message is automatically generated by JIRA.
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message