[jboss-user] [JBoss Portal] - Re: upload zip archive bug : NegativeArraySizeException

roy.russo@jboss.com do-not-reply at jboss.com
Mon Dec 4 12:00:56 EST 2006


I've spent the better part of today playing with this, and researching it... There doesnt seem to be a resolution, just that java's zipinputstream cant read non-standard zips. 

This is actually a pretty good site and info: http://mindprod.com/jgloss/zip.html Of course...

The following code won't work if ZipOutputStream was used to create the zip file. ZipEntry.getSize will return -1. 

So even thought you can change things to use a tempFile and use ZipFile, you still have to do:

         while (entries.hasMoreElements())
  |          {
  |             zipEntry = (ZipEntry)entries.nextElement();
  |             String itemName = zipEntry.getName();
  |             if (!zipEntry.isDirectory())
  |             {
  |                long fileSize = zipEntry.getSize();
  | 

Its the only way to read the file items, is to getSize, but if it returns -1, then we die again. So even using zipFile wont work.

I'll attach the changed I made to the jira, but for now, am adding some exception handling, as I dont see a workaround at all here.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3991048#3991048

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3991048



More information about the jboss-user mailing list