commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbros...@apache.org
Subject svn commit: r1346228 - /commons/sandbox/classscan/trunk/src/main/java/org/apache/commons/classscan/bcel/FileClassLocation.java
Date Tue, 05 Jun 2012 04:01:53 GMT
Author: dbrosius
Date: Tue Jun  5 04:01:53 2012
New Revision: 1346228

URL: http://svn.apache.org/viewvc?rev=1346228&view=rev
Log:
make sure file streams get closed

Modified:
    commons/sandbox/classscan/trunk/src/main/java/org/apache/commons/classscan/bcel/FileClassLocation.java

Modified: commons/sandbox/classscan/trunk/src/main/java/org/apache/commons/classscan/bcel/FileClassLocation.java
URL: http://svn.apache.org/viewvc/commons/sandbox/classscan/trunk/src/main/java/org/apache/commons/classscan/bcel/FileClassLocation.java?rev=1346228&r1=1346227&r2=1346228&view=diff
==============================================================================
--- commons/sandbox/classscan/trunk/src/main/java/org/apache/commons/classscan/bcel/FileClassLocation.java
(original)
+++ commons/sandbox/classscan/trunk/src/main/java/org/apache/commons/classscan/bcel/FileClassLocation.java
Tue Jun  5 04:01:53 2012
@@ -13,6 +13,7 @@
  */
 package org.apache.commons.classscan.bcel;
 
+import java.io.BufferedInputStream;
 import java.io.File;
 import java.io.FileFilter;
 import java.io.FileInputStream;
@@ -110,13 +111,23 @@ public class FileClassLocation extends U
     }
 
     private void addClass(String fullPath, File path) {
+        InputStream is = null;
         try {
-            InputStream is = new FileInputStream(path);
+            is = new BufferedInputStream(new FileInputStream(path));
             addClass(fullPath, is);
         }
         catch (Exception ex) {
             logger.debug("Failed to add class " + fullPath, ex);
         }
+        finally {
+            try {
+                if (is != null) {
+                    is.close();
+                } 
+            } catch (Exception ex) {
+                //ignore
+            }
+        }
     }
 
     void acceptMetaInf(File path) {



Mime
View raw message