ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r1378329 - /ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
Date Tue, 28 Aug 2012 20:51:02 GMT
Author: hibou
Date: Tue Aug 28 20:51:02 2012
New Revision: 1378329

URL: http://svn.apache.org/viewvc?rev=1378329&view=rev
Log:
fix test on windows: fix file descriptor leak while unziping

Modified:
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java?rev=1378329&r1=1378328&r2=1378329&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
Tue Aug 28 20:51:02 2012
@@ -936,8 +936,9 @@ public class DefaultRepositoryCacheManag
         } else {
             if (compression.equals("zip") || compression.equals("jar") || compression.equals("war"))
{
                 Message.info("\tUncompressing " + artifact.getId());
+                ZipFile zipFile = null;
                 try {
-                    ZipFile zipFile = new ZipFile(adr.getLocalFile());
+                    zipFile = new ZipFile(adr.getLocalFile());
                     Enumeration entries = zipFile.entries();
                     while (entries.hasMoreElements()) {
                         ZipEntry entry = (ZipEntry) entries.nextElement();
@@ -983,6 +984,14 @@ public class DefaultRepositoryCacheManag
                     adr.setDownloadStatus(DownloadStatus.FAILED);
                     adr.setDownloadDetails("The compressed artifact " + artifact.getId()
                             + " could not be uncompressed (" + e.getMessage() + ")");
+                } finally {
+                    if (zipFile != null) {
+                        try {
+                            zipFile.close();
+                        } catch (IOException e) {
+                            // ignore
+                        }
+                    }
                 }
             } else {
                 adr.setDownloadStatus(DownloadStatus.FAILED);



Mime
View raw message