T
tshad
I have a zipfile that I am trying to close because the file is corrupted and
I get an error on it:
Exception of type 'java.util.zip.ZipException' was thrown
So I handle the error and finally try to close the error. But there appears
to be some time of timing issue.
ZipFile zipfile = null;
try
{
zipfile = new ZipFile(zipFileName);
}
catch(Exception exc)
{
throw new Exception("File: " + zipFileName + " Corrupted",
exc);
}
finally
{
if (zipfile != null)
{
zipfile.close();
}
}
In the above code, I get the exception and get the if (zipfile != null) test
and this is where it all takes a different path depending on how long I
take.
If the "if" test was not there, I would get an error saying that the object
does not exist and I will then get an error saying that I can't move it
because it is in use. If I trace through it, it also doesn't get to the
zipfile.close(), but it allows me to move it so it is obviously not in use.
How can I handle this? I can't use a "using" clause as it is not
IDisposable.
It seems to close if I step through which seems to allow it to get released.
Thanks,
Tom
I get an error on it:
Exception of type 'java.util.zip.ZipException' was thrown
So I handle the error and finally try to close the error. But there appears
to be some time of timing issue.
ZipFile zipfile = null;
try
{
zipfile = new ZipFile(zipFileName);
}
catch(Exception exc)
{
throw new Exception("File: " + zipFileName + " Corrupted",
exc);
}
finally
{
if (zipfile != null)
{
zipfile.close();
}
}
In the above code, I get the exception and get the if (zipfile != null) test
and this is where it all takes a different path depending on how long I
take.
If the "if" test was not there, I would get an error saying that the object
does not exist and I will then get an error saying that I can't move it
because it is in use. If I trace through it, it also doesn't get to the
zipfile.close(), but it allows me to move it so it is obviously not in use.
How can I handle this? I can't use a "using" clause as it is not
IDisposable.
It seems to close if I step through which seems to allow it to get released.
Thanks,
Tom