Zero length zip file

T

tshad

Found an interesting problem with the zip extraction class that comes with
vjslib.dll.

If you have a corrupt file, it takes the exception fine. But if you have a
zero length file, it will set on the line where you are creating the ZipCode
object and never return.

If you have a zero length zip file and try to create the ZipFile object, the
system will appear to freeze. It doesn't actually freeze, however. If you
look at Task Manager you would see that the cpu is being gobbled up
(actually it is doing tons of I/O).



Here is the code I am using and as you can see there is a catch which
catches corrupted files. The catch works fine if the file is corrupted.
But it will stay at the 3rd line forever if it is a zero length file and
never take the catch.



I now just checked the length before going into the zip file class to solve
the problem. But you would think it would take the catch path or return a
null object if a zero lenght file.



try

{

zipfile = new ZipFile(zipFileName);

}

catch (Exception exc)

{

throw new Exception("File: " + zipFileName + " Corrupted ",
exc);

}

finally

{

if (zipfile != null)

{

zipfile.close();

}

else

System.GC.Collect();



Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top