Hi

Back to the cause analysis of the gc mystery:
It seems to me that expandFile of Expand.java (the class implementing the unzip task) leaks non
explicitly closed streams, that are very likely to lead to open file handles from the expandFile
method.


I will verify and test the following patch, just don't know how to test it yet
(I haven't even verified yet if it compiles!).


Kind Regards, Martijn

Index: org/apache/tools/ant/taskdefs/Expand.java
===================================================================
retrieving revision 1.53
diff -u -r1.53 Expand.java
--- org/apache/tools/ant/taskdefs/Expand.java 9 Mar 2004 16:48:04 -0000 1.53
+++ org/apache/tools/ant/taskdefs/Expand.java 19 Mar 2004 18:16:53 -0000
@@ -117,9 +117,16 @@
Enumeration e = zf.getEntries();
while (e.hasMoreElements()) {
ZipEntry ze = (ZipEntry) e.nextElement();
- extractFile(fileUtils, srcF, dir, zf.getInputStream(ze),
- ze.getName(), new Date(ze.getTime()),
- ze.isDirectory());
+ InputStream is = zf.getInputStream(ze);
+ try {
+ extractFile(fileUtils, srcF, dir, is,
+ ze.getName(), new Date(ze.getTime()),
+ ze.isDirectory());
+ } finally {
+ if (is != null) {
+ is.close();
+ }
+ }
}


            log("expand complete", Project.MSG_VERBOSE);



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to