Author: markt Date: Mon Feb 24 17:10:59 2014 New Revision: 1571355 URL: http://svn.apache.org/r1571355 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56177 Handle dependency tracking for TLDs when using JspC with a tag library JAR that is located outside of the web application.
Modified: tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java?rev=1571355&r1=1571354&r2=1571355&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java (original) +++ tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java Mon Feb 24 17:10:59 2014 @@ -22,6 +22,7 @@ import java.io.StringWriter; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; +import java.net.URLConnection; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; @@ -133,10 +134,36 @@ class TagLibraryInfoImpl extends TagLibr // Add the dependencies on the TLD to the referencing page PageInfo pageInfo = ctxt.createCompiler().getPageInfo(); if (pageInfo != null) { + // If the TLD is in a JAR, that JAR may not be part of the web + // application String path = tldResourcePath.getWebappPath(); - // Add TLD (jar==null) / JAR (jar!=null) file to dependency list - pageInfo.addDependant(path, ctxt.getLastModified(path)); + if (path != null) { + // Add TLD (jar==null) / JAR (jar!=null) file to dependency list + pageInfo.addDependant(path, ctxt.getLastModified(path)); + } if (jar != null) { + if (path == null) { + // JAR not in the web application so add it directly + URL jarUrl = jar.getJarFileURL(); + long lastMod = -1; + URLConnection urlConn = null; + try { + urlConn = jarUrl.openConnection(); + lastMod = urlConn.getLastModified(); + } catch (IOException ioe) { + throw new JasperException(ioe); + } finally { + if (urlConn != null) { + try { + urlConn.getInputStream().close(); + } catch (IOException e) { + // Ignore + } + } + } + pageInfo.addDependant(jarUrl.toExternalForm(), + Long.valueOf(lastMod)); + } // Add TLD within the JAR to the dependency list String entryName = tldResourcePath.getEntryName(); try { Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1571355&r1=1571354&r2=1571355&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Mon Feb 24 17:10:59 2014 @@ -99,6 +99,11 @@ <bug>56179</bug>: Fix parsing of EL expressions that contain unnecessary parentheses. (markt) </fix> + <fix> + <bug>56177</bug>: Handle dependency tracking for TLDs when using JspC + with a tag library JAR that is located outside of the web application. + (markt) + </fix> </changelog> </subsection> <subsection name="WebSocket"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org