geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r579717 - /geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/AbstractRepository.java
Date Wed, 26 Sep 2007 17:02:49 GMT
Author: gawor
Date: Wed Sep 26 10:02:45 2007
New Revision: 579717

URL: http://svn.apache.org/viewvc?rev=579717&view=rev
Log:
let's close the zip file

Modified:
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/AbstractRepository.java

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/AbstractRepository.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/AbstractRepository.java?rev=579717&r1=579716&r2=579717&view=diff
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/AbstractRepository.java
(original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/AbstractRepository.java
Wed Sep 26 10:02:45 2007
@@ -160,14 +160,19 @@
             throw new IllegalArgumentException("Cannot read source file at " + source.getAbsolutePath());
         }
         int size = 0;
+        ZipFile zip = null;
         try {
-            ZipFile zip = new ZipFile(source);
+            zip = new ZipFile(source);
             for (Enumeration entries=zip.entries(); entries.hasMoreElements();) {
             	ZipEntry entry = (ZipEntry)entries.nextElement();
             	size += entry.getSize();
             }
         } catch (ZipException ze) {
-        	size = (int)source.length();
+            size = (int)source.length();
+        } finally {
+            if (zip != null) {
+                zip.close();
+            }
         }
         FileInputStream is = new FileInputStream(source);
         try {



Mime
View raw message