kbennett wrote:
> I'm getting an error when running the TestParsers test. The test appears to
> look for the XML configuration file in the first directory in the class
> path, which, in my case, is in the Java home directory tree:
>
> /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/lib/config/config.xml
>
> TestParsers.setUp() contains the following code:
>
> ----
> String sep = File.separator;
> StringTokenizer st = new StringTokenizer(System.getProperty(
> "java.class.path"), File.pathSeparator);
>
> classDir = new File(st.nextToken());
>
> config = classDir.getParent() + sep + "config" + sep + "config.xml";
> ----
I noticed this too, that is why I didn't attack tika-11.
> Is there another way we can specify the location of the config.xml file that
> would be more reliable? Maybe by the following?:
>
> URL configUrl = this.getClass().getResource("/config.xml");
>
> I noticed there is already a config.xml in src/main/resources, which is
> where it should be for the getResource() call above to work.
>
> Then, we'd also need to change:
>
> LiusConfig getInstance(String configFile)
> to
> LiusConfig getInstance(URL configUrl)
This sounds like a good direction to me, I would however use a context
classloader to find the resource and not a static one.
--
Sami Siren