tika-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rida Benjelloun" <rida.benjell...@doculibre.com>
Subject Re: TestParser Fails to Find config.xml
Date Wed, 12 Sep 2007 21:37:02 GMT
+1

On 9/12/07, Sami Siren <ssiren@gmail.com> wrote:
>
> 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
>
>
>


-- 
---------------------------------------------------------
Rida Benjelloun
Doculibre inc.
ridabenjelloun@apache.org
rida.benjelloun@doculibre.com
Cel: 418-262-3222
Tel: 418-353-3390
Site Web : http://www.doculibre.com
---------------------------------------------------------

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message