Closed GoogleCodeExporter closed 9 years ago
Using the contextClassLoader seems to be a really bad idea here. It should just
use the static ResourceUtils.class classloader.
Original comment by richard.eckart
on 16 Aug 2012 at 10:45
Changed in rev 863. Should work now using ResourceUtils.class.getResource.
Another (generally not very good, but probably) workaround in a static context
would be
URL url = ResourceUtils.resolveLocation("classpath:/foo/bar",
MyStaticClass.class, null);
Actually, another method should be added with the following signature:
URL resolveLocation(String aLocation, Classloader aClassloader, UimaContext aContext)
Passing in the caller seemed a convenient idea (and probably still is) but does
not provide the necessary level of control.
Original comment by richard.eckart
on 16 Aug 2012 at 10:51
Added a couple of additional signatures for resolveLocation, including one
which takes a classloader (and now is the central one).
revision 864
Original comment by richard.eckart
on 16 Aug 2012 at 10:57
Btw. the context classloader might even have worked, but the URL passed to it
would be wrong. While one would call e.g.
getClass().getResource("/my/resource.xml")
one has to say
classloader.getResource("my/resource.xml") to achieve the same thing. If the
"/" is left in front, it would always return null.
Original comment by richard.eckart
on 16 Aug 2012 at 12:02
Original issue reported on code.google.com by
tristan.miller@nothingisreal.com
on 16 Aug 2012 at 10:31Attachments: