You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by sc...@apache.org on 2014/11/21 19:56:48 UTC
svn commit: r1640976 -
/tomcat/trunk/java/org/apache/jasper/compiler/TagFileProcessor.java
Author: schultz
Date: Fri Nov 21 18:56:48 2014
New Revision: 1640976
URL: http://svn.apache.org/r1640976
Log:
Fix Coverty issue 45316: close Jar resource after use.
Modified:
tomcat/trunk/java/org/apache/jasper/compiler/TagFileProcessor.java
Modified: tomcat/trunk/java/org/apache/jasper/compiler/TagFileProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/TagFileProcessor.java?rev=1640976&r1=1640975&r2=1640976&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/TagFileProcessor.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/TagFileProcessor.java Fri Nov 21 18:56:48 2014
@@ -630,28 +630,32 @@ class TagFileProcessor {
TldResourcePath tldResourcePath =
compiler.getCompilationContext().getTldResourcePath(
tagFileInfo.getTagInfo().getTagLibrary().getURI());
- Jar jar;
- try {
+
+ Jar jar = null;
+ try
+ {
jar = tldResourcePath.getJar();
- } catch (IOException ioe) {
- throw new JasperException(ioe);
- }
- if (jar != null) {
- try {
+
+ if (jar != null) {
// Add TLD
pageInfo.addDependant(jar.getURL(tldResourcePath.getEntryName()),
- Long.valueOf(jar.getLastModified(tldResourcePath.getEntryName())));
+ Long.valueOf(jar.getLastModified(tldResourcePath.getEntryName())));
// Add Tag
pageInfo.addDependant(jar.getURL(tagFilePath.substring(1)),
- Long.valueOf(jar.getLastModified(tagFilePath.substring(1))));
- } catch (IOException ioe) {
- throw new JasperException(ioe);
+ Long.valueOf(jar.getLastModified(tagFilePath.substring(1))));
+ }
+ else {
+ pageInfo.addDependant(tagFilePath,
+ compiler.getCompilationContext().getLastModified(
+ tagFilePath));
}
+ } catch (IOException ioe) {
+ throw new JasperException(ioe);
}
- else {
- pageInfo.addDependant(tagFilePath,
- compiler.getCompilationContext().getLastModified(
- tagFilePath));
+ finally
+ {
+ if(null != jar)
+ jar.close(); // Jar.close does not "throw IOException" but probably should
}
} else {
pageInfo.addDependant(tagFilePath,
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org