Author: violetagg
Date: Thu Sep 25 07:17:31 2014
New Revision: 1627469

URL: http://svn.apache.org/r1627469
Log:
Merged revision 1626579 from tomcat/trunk:
Fix a potential resource leak in JDTCompiler when checking wether
a resource is a package. Reported by Coverity Scan.

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

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

Modified: tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/JDTCompiler.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/JDTCompiler.java?rev=1627469&r1=1627468&r2=1627469&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/JDTCompiler.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/JDTCompiler.java Thu 
Sep 25 07:17:31 2014
@@ -255,9 +255,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) {
+                            }
+                        }
+                    }
                 }
 
                 @Override

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=1627469&r1=1627468&r2=1627469&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Thu Sep 25 07:17:31 2014
@@ -232,6 +232,10 @@
         <jsp-file> declaration to Jasper and prevent an infinite loop
         if this technique is used in conjunction with an include. (markt)
       </fix>
+      <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="WebSocket">



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

Reply via email to