48737 2010-02-13 18:19:03 +0000 JspCompilationContext assumes that tagfile with a path starting with META-INF are in jars without checking 2010-05-14 15:53:09 +0000 1 1 1 Unclassified Tomcat 6 Jasper 6.0.24 PC Linux RESOLVED FIXED P2 normal default 1 fgiust dev 0 oldest_to_newest 134471 0 24978 fgiust 2010-02-13 18:19:03 +0000 Created attachment 24978 patch to JspCompilationContext This is a pretty special case, since tagfiles in META-INF are usually in jar files... but when using a custom dircontext implementation (usually during development in order to load files from the filesystem without building a full jar) it may happen that the path given to jasper starts with META-INF also if the file is not in a jar. This is what happens using the Eclipse WTP tomcat loader, which loads classes from the workspaces and tld/tagfiles from directories inside your projects. Tagfiles contained in META-INF directories worked properly till tomcat 6.0.17, but the final fix for BUG 43741 broke it (I am still using 6.0.16 and not upgrading due to this problem). Looking at JspCompilationContext.getResource() the patch to solve this problem would be very simple and "safe": if the path starts with META-INF and a jar file containing the tld doesn't exist the resulting URL is simply null. Adding a check for the null jar and setting the URL to the "standard" path inside the context fixes the problem and everything starts working again (note that this doesn't break the previous fix and it can't cause any problem, since the result would have been null anyway). A patch against trunk (2010-02-13) is attached, the following code should easily displays what the patch does: URL result = null; if (res.startsWith("/META-INF/")) { // some lines to get the jar url // ... if (jarUrl != null) { result = new URL(jarUrl.toExternalForm() + res.substring(1)); } + else { + // the path starts with /META-INF but the file is not in a jar + result = context.getResource(canonicalURI(res)); + } } 135188 1 markt 2010-03-09 12:34:30 +0000 Thanks for the patch. This has been fixed in trunk and proposed for 6.0.x 135382 2 fgiust 2010-03-16 14:42:10 +0000 (In reply to comment #1) > Thanks for the patch. > > This has been fixed in trunk and proposed for 6.0.x great! Can you tell if it has been included in 6.0.26? I couldn't find a good way to guess this from bugzilla... 135383 3 markt 2010-03-16 15:15:57 +0000 That would be what the 6.0.26 change log is for. 135491 4 fgiust 2010-03-21 19:10:44 +0000 (In reply to comment #3) > That would be what the 6.0.26 change log is for. you are right, I'm too used with the "fixed versions" in jira... so it's not in 6.0.26, any chance to see it in a 6.0.x release soon? Thanks 136872 5 markt 2010-05-14 15:53:09 +0000 Thanks again for the patch. This has been fixed in 6.0.x and will be included in 6.0.27 onwards. 24978 2010-02-13 18:19:03 +0000 2010-02-13 18:19:03 +0000 patch to JspCompilationContext tagfile_in_metainf_patch.diff text/plain 764 fgiust SW5kZXg6IGphdmEvb3JnL2FwYWNoZS9qYXNwZXIvSnNwQ29tcGlsYXRpb25Db250ZXh0LmphdmEK PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PQotLS0gamF2YS9vcmcvYXBhY2hlL2phc3Blci9Kc3BDb21waWxhdGlvbkNvbnRl eHQuamF2YQkocmV2aXNpb24gOTA5ODQ2KQorKysgamF2YS9vcmcvYXBhY2hlL2phc3Blci9Kc3BD b21waWxhdGlvbkNvbnRleHQuamF2YQkod29ya2luZyBjb3B5KQpAQCAtMjk1LDYgKzI5NSwxMCBA QAogICAgICAgICAgICAgaWYgKGphclVybCAhPSBudWxsKSB7CiAgICAgICAgICAgICAgICAgcmVz dWx0ID0gbmV3IFVSTChqYXJVcmwudG9FeHRlcm5hbEZvcm0oKSArIHJlcy5zdWJzdHJpbmcoMSkp OwogICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZSB7CisgICAgICAgICAgICAgICAgLy8g dGhlIHBhdGggc3RhcnRzIHdpdGggL01FVEEtSU5GIGJ1dCB0aGUgZmlsZSBpcyBub3QgaW4gYSBq YXIKKyAgICAgICAgICAgICAgICByZXN1bHQgPSBjb250ZXh0LmdldFJlc291cmNlKGNhbm9uaWNh bFVSSShyZXMpKTsKKyAgICAgICAgICAgIH0KICAgICAgICAgfSBlbHNlIGlmIChyZXMuc3RhcnRz V2l0aCgiamFyOmZpbGU6IikpIHsKICAgICAgICAgICAgICAgICAvLyBUaGlzIGlzIGEgdGFnIGZp bGUgcGFja2FnZWQgaW4gYSBqYXIgdGhhdCBpcyBiZWluZyBjaGVja2VkCiAgICAgICAgICAgICAg ICAgLy8gZm9yIGEgZGVwZW5kZW5jeQo=