On 2014-01-02, Jesse Glick wrote:

> On Thu, Jan 2, 2014 at 2:22 AM,  <bode...@apache.org> wrote:
>+                        try {
>+                            jarFile = new JarFile(file);
>+                        } catch (ZipException notAJar) {
>+                            // raised if a file that is not a ZIP

> Would also be thrown if the file _is_ a ZIP file but there was some
> (potentially significant) error opening it.

Right.

> Could consider checking the file header for the magic sequence {0x50,
> 0x4b, 0x03, 0x04} and rethrowing the exception. (Have observed {0x50,
> 0x4b, 0x05, 0x06} in empty archives as well,

or PK00.  I know, I spent some time with the format :-)

You are right, of course, will port over ZipArchiveInputStream#matches
from Commons Compress.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org

Reply via email to