java.lang.ArrayIndexOutOfBoundsException: 65536
at java.io.FileInputStream.read(SByte[] buffer, Int32 offset, Int32
count)
at java.util.zip.ZipFile.readZIPEntries(String fname)
An unhandled exception of type 'java.util.zip.ZipException' occurred
in vjslib.dll
Nestor
Lars-Inge
ZipFile zf = new ZipFile( "file.zip" );
This file.zip was created fine by using:
new ZipOutputStream(new java.io.FileOutputStream("file.zip")).close();
If I call new ZipFile( "file.zip" ) on the new empty file, all works well.
BUT,
as soon as I add a file to the file.zip and then call new ZipFile( "file.zip" ), I get an exception.
If I then go to winzip then look at the "file.zip" I have no problems extracting a file etc.
Is this a bug in the java lib that comes with VS.NET 2003?
thanks - bill
**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
--------------------
>>From: Bill Andreozzi (bill...@towncompass.com)
>>Subject: Re: java.util.zip problem
>>References: <838ffa3f.03050...@posting.google.com>
>>Message-ID: <OdPBvSZF...@TK2MSFTNGP10.phx.gbl>
>>Newsgroups: microsoft.public.dotnet.vjsharp
>>Date: Thu, 08 May 2003 12:04:41 -0700
>>NNTP-Posting-Host: shared2.orcsweb.com 66.129.69.1
>>Lines: 1
>>Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
>>Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.vjsharp:3741
>>X-Tomcat-NG: microsoft.public.dotnet.vjsharp
--
ShankarA, Visual J# .NET Team
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Thx,
Tim Meagher
"Ianier Munoz" <ianier[nospam]@hotmail.com> wrote in message
news:#fa7vSfF...@TK2MSFTNGP10.phx.gbl...
> Hi Nestor,
> FYI, compression is OK. The problem is when decompressing the file.
> For example, the attached file fails to open with with the
> java.util.zip.ZipFile class. That is, new ZipFile("xx.zip") fails with the
> exception you mention. Winzip can open it without problems.
> Ianier
>
> <nestorac...@hotmail.com> wrote in message
> news:838ffa3f.03050...@posting.google.com...
java.lang.ArrayIndexOutOfBoundsException: 65536
at java.io.FileInputStream.read(SByte[] buffer, Int32 offset, Int32
count)
at java.util.zip.ZipFile.readZIPEntries(String fname)
I really need a workaround or a fix for this. Is it fixed in .NET 2003?
Alex E. Niblett
Microsoft Certified Solution Developer
Senior Software Architect
Cornerstone Research
http://www.cstoneresearch.com
1. Upon review of Ianier's article, it is clear that the decompression and
re-compression is taking place as part of the copy:
"Copying an entry involves decompressing the entry from the source file ...
and recompressing it again to the destination file" (p.83, 2nd paragraph
under "Creating and Modifying Zip Files).
2. Although the exception
java.lang.ArrayIndexOutOfBoundsException: 65536
at java.io.FileInputStream.read(SByte[] buffer, Int32 offset, Int32
count)
at java.util.zip.ZipFile.readZIPEntries(String fname)
is occurring, the PDF files consisting of multi-page TIFs ARE getting
successfully copied into the aggregate zipfile, and when extracted, they
compare exactly the same. It makes me wonder if the problem is only in the
exception handling capabilities of the jsharp zip library.
- Tim Meagher
"Tim Meagher" <t...@aaom.net> wrote in message
news:uWcWZSWG...@TK2MSFTNGP12.phx.gbl...
> 1. Upon review of Ianier's article, it is clear that the decompression and
> re-compression is taking place as part of the copy:
Yes. The exception is thrown when the file is opened just after
recompression. If you exit the program at this point, you'll see that the
resulting file can be succesfully opened with Winzip.
> It makes me wonder if the problem is only in the
> exception handling capabilities of the jsharp zip library.
I tried the same code in a J# program and I got the same exception, so the
problem is definitely not related to J#/C# interoperability.
We could disassemble the vsjlib to get some clues :-), but I would prefer
that someone from MS explain what happens exactly.
Regards,
--
Ianier Munoz
http://www.chronotron.com
"Tim Meagher" <t...@aaom.net> wrote in message
news:%23i0wC5W...@TK2MSFTNGP12.phx.gbl...
--------------------
>>From: "Ianier Munoz" <ianier[nospam]@hotmail.com>
>>References: <838ffa3f.03050...@posting.google.com>
<#fa7vSfF...@TK2MSFTNGP10.phx.gbl>
<uWcWZSWG...@TK2MSFTNGP12.phx.gbl>
<#i0wC5WG...@TK2MSFTNGP12.phx.gbl>
>>Subject: Re: java.util.zip problem
>>Date: Tue, 13 May 2003 19:42:48 +0200
>>Lines: 105
>>X-Priority: 3
>>X-MSMail-Priority: Normal
>>X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
>>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
>>Message-ID: <uxY#UcXGDH...@TK2MSFTNGP10.phx.gbl>
>>Newsgroups: microsoft.public.dotnet.vjsharp
>>NNTP-Posting-Host: dyn-81-191-155-133.ppp.tiscali.fr 81.191.155.133
>>Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
>>Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.vjsharp:3766
>>X-Tomcat-NG: microsoft.public.dotnet.vjsharp
"I was able to debug into the JSharp zip code and the exception is being
thrown because the pdf file contains some invalid (from J#'s point of view)
data. It's looking for one of the following:
local file header signature - 0x04034b50
Central file header signature - 0x02014b50
End of central dir signature - 0x06054b50
As we are reading through the ZipFileEntries in the PDF file we are
expecting to see one of these values, if we don't we throw the ZipException.
Can you get this exception with an actual .zip file? The PDF file may add
some data that we don't recognize, and that might very well be the cause of
the problem."
I responded to Microsoft and indicated that the problem was not specific to
a PDF file - in fact I provided a multi-page tiff file which also resulted
in an exception. It occurred to me that I should try to create the archive
with WinZip and then try to decompress it with the jsharp libraries - again
using Ianier's ZipUtils wrappers. This time the decompression was
successful. This leads me to believe that the exception may be thrown
because the jsharp zip compression is not able to properly embed the
necessary information in the archive for multi-page tiff files that are
subsequently decomperssed.
I will continue to report on my findings from Microsoft as they become
available.
- Tim
"Ianier Munoz" <ianier[nospam]@hotmail.com> wrote in message
news:uxY#UcXGDH...@TK2MSFTNGP10.phx.gbl...
"Tim Meagher" <t...@aaom.net> wrote in message
news:OORVOn1G...@TK2MSFTNGP10.phx.gbl...
For now it looks like one can merely catch and ignore the exception.
Regards,
Tim
"Ianier Munoz" <ianier[nospam]@hotmail.com> wrote in message
news:eSkyQo3G...@tk2msftngp13.phx.gbl...