ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 46559] New: org.apache.tools.zip.ZipFile leaves open file after RuntimeException
Date Mon, 19 Jan 2009 12:59:29 GMT
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.

Mime
View raw message