tjg184 / urlrewritefilter

Automatically exported from code.google.com/p/urlrewritefilter
Other
0 stars 0 forks source link

bug: config loading uses System classload not current thread's classloader #150

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Place config file under /WEB-INF/classes/conf
2. Configure confPath in filter rule in web.xml as /conf/urlrewrite.xml
3.

What is the expected output?
The config file should load. It does not.

What do you see instead?
21:52:49.571 [ajp-bio-8009-exec-3] ERROR o.t.w.f.u.UrlRewriteFilter - unable to 
find urlrewrite conf file at /conf/urlrewrite.xml

What version of the product are you using? 
4.0.3

On what operating system?
Linux, Tomcat7

Please provide any additional information below.
The use of the System classloader in URLRewriteFilter:loadUrlRewriterLocal is 
incorrect.

The code at line 267 

        if ( inputStream == null ) {
            inputStream = ClassLoader.getSystemResourceAsStream(confPath);
        }

should use the current thread's classloader instead.

        if ( inputStream == null ) {
            inputStream = Thread.currentThread.getContextClassLoader().getResourceAsStream(confPath);
        }

This was previously reported (Issue #28) and closed. I believe this to be 
incorrect.

I have verified the failure of the system classloader by attempting to load my 
own resources using that instead of the current thread's classloader. 

Chris

Original issue reported on code.google.com by cheshira...@gmail.com on 10 Oct 2013 at 10:06

GoogleCodeExporter commented 9 years ago
Submitted a patch to 
https://code.google.com/p/urlrewritefilter/issues/detail?id=164 that fixes this 
issue in addition to another.

Original comment by pet...@aetheric.co.nz on 1 Jul 2014 at 3:20