tjg184 / urlrewritefilter

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

Loading config from servlet 3 web-fragment classpath fails #164

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
To reproduce:
1. Create a web-fragment with "/META-INF/resources/WEB-INF/urlrewrite.xml".
2. Set "confPath" to "classpath:/WEB-INF/urlrewrite.xml"
3. Start the app.

The application should catch the MalformedURLException thrown by attempting to 
use a "classpath:" prefix on UrlRewriteFilter:270, and progress on to line 273, 
where using the ClassLoader processes it just fine.

Maven: org.tuckey:urlrewritefilter:4.0.3
Server: JBoss 6.1.0.Final (apache tomcat)
OS: Windows 8 x64, JDK 7

Related tangentially to:
https://code.google.com/p/urlrewritefilter/issues/detail?id=150

Should only require changing:

    InputStream inputStream = context.getResourceAsStream(confPath);

to:

    InputStream inputStream = null;
    try {
        inputStream = context.getResourceAsStream(confPath);
    } catch (MalformedURLException e) {
        log.debug(e);
    }

Original issue reported on code.google.com by pet...@aetheric.co.nz on 1 Jul 2014 at 2:24

GoogleCodeExporter commented 9 years ago
Ok, so after fiddling around with the code, the issue isn't as straightforward 
as I had thought. I'll do some more investigation and submit a patch to fix the 
issue.

Original comment by pet...@aetheric.co.nz on 1 Jul 2014 at 2:49

GoogleCodeExporter commented 9 years ago
The attached patch should fix both this issue and issue #150, as well as making 
the code clearer, with less redundancy.

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

Attachments:

GoogleCodeExporter commented 9 years ago
Apologies if the tests are failing. I'll see about sorting that out tomorrow. 
I'm maintaining a fork of the code at https://github.com/Tzrlk/UrlRewriteFilter/

Original comment by pet...@aetheric.co.nz on 1 Jul 2014 at 5:19