Author: markt
Date: Tue Jan 14 12:04:41 2014
New Revision: 1558019
URL: http://svn.apache.org/r1558019
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55995
Fix NPE when using JspC and there are JARs containing TLDs on the classpath
Modified:
tomcat/trunk/java/org/apache/jasper/compiler/TldCache.java
Modified: tomcat/trunk/java/org/apache/jasper/compiler/TldCache.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/TldCache.java?rev=1558019&r1=1558018&r2=1558019&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/TldCache.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/TldCache.java Tue Jan 14
12:04:41 2014
@@ -121,14 +121,19 @@ public class TldCache {
result[0] = -1;
result[1] = -1;
try {
- URL url =
servletContext.getResource(tldResourcePath.getWebappPath());
- URLConnection conn = url.openConnection();
- result[0] = conn.getLastModified();
- if ("file".equals(url.getProtocol())) {
- // Reading the last modified time opens an input stream so we
- // need to make sure it is closed again otherwise the TLD file
- // will be locked until GC runs.
- conn.getInputStream().close();
+ String webappPath = tldResourcePath.getWebappPath();
+ if (webappPath != null) {
+ // webappPath will be null for JARs containing TLDs that are on
+ // the class path but not part of the web application
+ URL url =
servletContext.getResource(tldResourcePath.getWebappPath());
+ URLConnection conn = url.openConnection();
+ result[0] = conn.getLastModified();
+ if ("file".equals(url.getProtocol())) {
+ // Reading the last modified time opens an input stream so
we
+ // need to make sure it is closed again otherwise the TLD
file
+ // will be locked until GC runs.
+ conn.getInputStream().close();
+ }
}
Jar jar = tldResourcePath.getJar();
if (jar != null) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]