You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2009/01/19 13:59:29 UTC
DO NOT REPLY [Bug 46559] New: org.apache.tools.zip.ZipFile leaves
open file after RuntimeException
https://issues.apache.org/bugzilla/show_bug.cgi?id=46559
Summary: org.apache.tools.zip.ZipFile leaves open file after
RuntimeException
Product: Ant
Version: unspecified
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P2
Component: Core
AssignedTo: notifications@ant.apache.org
ReportedBy: highnoon@yahoo.com
When a corrupted zip is read the method "resolveLocalFileHeaderData()" will
throw a RuntimeException. This exception is never caught so the archive file is
never closed and remains opened. The code calling constructor never gets a
handle on the object, so you can't close the archive. The Archive remains open
until JVM exits.
public ZipFile(File f, String encoding) throws IOException {
this.encoding = encoding;
archive = new RandomAccessFile(f, "r");
try {
populateFromCentralDirectory();
resolveLocalFileHeaderData();
} catch (IOException e) {
try {
archive.close();
} catch (IOException e2) {
// swallow, throw the original exception instead
}
throw e;
}
}
The RuntimeException stack
RuntimeException: data starting at 49679 is in unknown format
at org.apache.tools.zip.ZipEntry.setExtra(ZipEntry.java:268)
at org.apache.tools.zip.ZipFile.resolveLocalFileHeaderData(ZipFile.java:445)
at org.apache.tools.zip.ZipFile.<init>(ZipFile.java:144)
at org.apache.tools.zip.ZipFile.<init>(ZipFile.java:102)
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 46559] org.apache.tools.zip.ZipFile leaves open
file after RuntimeException
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46559
Stefan Bodewig <bo...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #2 from Stefan Bodewig <bo...@apache.org> 2009-01-29 05:25:02 PST ---
For now I've used the jar attached to bug 42940 which will need to be changed
once that bug is fixed.
Testcase added and Ant fixed with svn revision 738853 ( https://svn.apache.org/viewcvs.cgi?view=rev&rev=738853 )
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
DO NOT REPLY [Bug 46559] org.apache.tools.zip.ZipFile leaves open
file after RuntimeException
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46559
Stefan Bodewig <bo...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |notifications@ant.apache.org
AssignedTo|notifications@ant.apache.org|bodewig@apache.org
Target Milestone|--- |1.8.0
Version|unspecified |1.7.1
--- Comment #1 from Stefan Bodewig <bo...@apache.org> 2009-01-26 21:09:31 PST ---
I can easily think of a patch, but would love to have a test case.
Can you provide a testcase that will trigger a RuntimeExcpetion inside the
constructor?
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
You are the assignee for the bug.