Author: markt
Date: Tue Sep 30 13:31:45 2014
New Revision: 1628442

URL: http://svn.apache.org/r1628442
Log:
Fix a potential resource leak in JDTCompiler when checking whether a resource 
is a package. Reported by Coverity Scan.

Modified:
    tomcat/tc6.0.x/trunk/   (props changed)
    tomcat/tc6.0.x/trunk/STATUS.txt
    tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JDTCompiler.java
    tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc6.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1626579
  Merged /tomcat/tc7.0.x/trunk:r1626579,1627469

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1628442&r1=1628441&r2=1628442&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Tue Sep 30 13:31:45 2014
@@ -92,15 +92,6 @@ PATCHES PROPOSED TO BACKPORT:
   +1: kkolinko, markt
   -1:
 
-* Fix a potential resource leak in JDTCompiler when checking wether
-  a resource is a package. Reported by Coverity Scan.
-
-  Motivation: An obvious issue that is easy to fix.
-
-  http://svn.apache.org/r1627469
-  +1: kkolinko, remm, markt
-  -1:
-
 * For https://issues.apache.org/bugzilla/show_bug.cgi?id=56079
   Switch to the signed versions of Apache Commons Daemon 1.0.15 binaries.
 

Modified: tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JDTCompiler.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JDTCompiler.java?rev=1628442&r1=1628441&r2=1628442&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JDTCompiler.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JDTCompiler.java Tue 
Sep 30 13:31:45 2014
@@ -234,9 +234,18 @@ public class JDTCompiler extends org.apa
                         return false;
                     }
                     String resourceName = result.replace('.', '/') + ".class";
-                    InputStream is = 
-                        classLoader.getResourceAsStream(resourceName);
-                    return is == null;
+                    InputStream is = null;
+                    try {
+                        is = classLoader.getResourceAsStream(resourceName);
+                        return is == null;
+                    } finally {
+                        if (is != null) {
+                            try {
+                                is.close();
+                            } catch (IOException e) {
+                            }
+                        }
+                    }
                 }
 
                 public boolean isPackage(char[][] parentPackageName, 

Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=1628442&r1=1628441&r2=1628442&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Tue Sep 30 13:31:45 2014
@@ -103,6 +103,10 @@
         <code>if { ... }</code> for alternative branches in the JSP parser.
         (kkolinko)
       </scode>
+      <fix>
+        Fix a potential resource leak in JDTCompiler when checking wether
+        a resource is a package. Reported by Coverity Scan. (fschumacher)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Other">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to