Author: sebb
Date: Tue Jun 16 22:12:05 2009
New Revision: 785427

URL: http://svn.apache.org/viewvc?rev=785427&view=rev
Log:
Bug 47377 - Make ClassFinder more robust and close zipfile resources

Modified:
    jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/ClassFinder.java
    jakarta/jmeter/trunk/xdocs/changes.xml

Modified: 
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/ClassFinder.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/ClassFinder.java?rev=785427&r1=785426&r2=785427&view=diff
==============================================================================
--- 
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/ClassFinder.java 
(original)
+++ 
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/ClassFinder.java 
Tue Jun 16 22:12:05 2009
@@ -411,12 +411,22 @@
         if (file.isDirectory()) {
             findClassesInPathsDir(strPath, file, listClasses);
         } else if (file.exists()) {
-            ZipFile zipFile = new ZipFile(file);
-            Enumeration entries = zipFile.entries();
-            while (entries.hasMoreElements()) {
-                String strEntry = entries.nextElement().toString();
-                if (strEntry.endsWith(DOT_CLASS)) {
-                    listClasses.add(fixClassName(strEntry));
+            ZipFile zipFile = null;
+            try {
+                zipFile = new ZipFile(file);
+                Enumeration entries = zipFile.entries();
+                while (entries.hasMoreElements()) {
+                    String strEntry = entries.nextElement().toString();
+                    if (strEntry.endsWith(DOT_CLASS)) {
+                        listClasses.add(fixClassName(strEntry));
+                        }
+                    }
+            } catch (IOException e) {
+                log.warn("Can not open the jar " + strPath + " " + 
e.getLocalizedMessage());
+            }
+            finally {
+                if(zipFile != null) {
+                    try {zipFile.close();} catch (Exception e) {}
                 }
             }
         }

Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=785427&r1=785426&r2=785427&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Tue Jun 16 22:12:05 2009
@@ -102,6 +102,7 @@
 <h3>General</h3>
 <ul>
 <li>Fix problems with remote clients - bug introduced in 2.3.3</li>
+<li>Bug 47377 - Make ClassFinder more robust and close zipfile resources</li>
 </ul>
 
 <!-- ==================================================== -->



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

Reply via email to