You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by vi...@apache.org on 2014/09/03 22:35:50 UTC
svn commit: r1622350 - in /tomcat/tc7.0.x/trunk: ./
java/org/apache/jasper/compiler/Compiler.java webapps/docs/changelog.xml
Author: violetagg
Date: Wed Sep 3 20:35:49 2014
New Revision: 1622350
URL: http://svn.apache.org/r1622350
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56908
Merged revision 1622342 from tomcat/trunk:
Fix some potential resource leaks when reading jar files. Reported by Coverity Scan. Based on patch provided by Felix Schumacher.
Modified:
tomcat/tc7.0.x/trunk/ (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/Compiler.java
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
Merged /tomcat/trunk:r1622342
Modified: tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/Compiler.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/Compiler.java?rev=1622350&r1=1622349&r2=1622350&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/Compiler.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/Compiler.java Wed Sep 3 20:35:49 2014
@@ -20,6 +20,7 @@ package org.apache.jasper.compiler;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
+import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
@@ -493,6 +494,7 @@ public abstract class Compiler {
Iterator<Entry<String,Long>> it = depends.entrySet().iterator();
while (it.hasNext()) {
Entry<String,Long> include = it.next();
+ URLConnection iuc = null;
try {
String key = include.getKey();
URL includeUrl;
@@ -505,7 +507,7 @@ public abstract class Compiler {
return true;
}
- URLConnection iuc = includeUrl.openConnection();
+ iuc = includeUrl.openConnection();
long includeLastModified = 0;
if (iuc instanceof JarURLConnection) {
includeLastModified =
@@ -513,7 +515,6 @@ public abstract class Compiler {
} else {
includeLastModified = iuc.getLastModified();
}
- iuc.getInputStream().close();
if (includeLastModified != include.getValue().longValue()) {
return true;
@@ -523,6 +524,13 @@ public abstract class Compiler {
log.debug("Problem accessing resource. Treat as outdated.",
e);
return true;
+ } finally {
+ if (iuc != null) {
+ try {
+ iuc.getInputStream().close();
+ } catch (IOException e) {
+ }
+ }
}
}
Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1622350&r1=1622349&r2=1622350&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Wed Sep 3 20:35:49 2014
@@ -175,6 +175,11 @@
will throw <code>IOException</code> when an I/O error occur during
the operation. (violetagg)
</fix>
+ <fix>
+ <bug>56908</bug>: Fix some potential resource leaks when reading jar
+ files. Reported by Coverity Scan. Based on patch provided by Felix
+ Schumacher. (violetagg)
+ </fix>
</changelog>
</subsection>
<subsection name="WebSocket">
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org