Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » ZipException: invalid entry compressed size
ZipException: invalid entry compressed size [message #322211] Fri, 09 November 2007 10:20 Go to next message
Eclipse UserFriend
Originally posted by: alexjaquet.gmail.com

Hi,

I'm trying to use the ArchiveURLConnection class to get a file from
a compressed jar.

Unfortunatly I got this exception : java.util.zip.ZipException: invalid
entry compressed size (expected 580 but got 576 bytes)

After reading some ZipEntries.

Any idea why my jar is like corrupted ?

Thanks
Re: ZipException: invalid entry compressed size [message #322212 is a reply to message #322211] Fri, 09 November 2007 10:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alexjaquet.gmail.com

Here is the code I use :

private void readJarEntries(IJavaProject project, IClasspathEntry entry) {
try {
URL url = new URL("jar:file:/" + entry.getPath().toString() + "!" +
removeProtocol());
ArchiveURLConnection urlConnection = new ArchiveURLConnection(url);
OutputStream output = urlConnection.getOutputStream();
if (output == null) {
System.out.println("null");
}
System.out.println(url.toString());
}catch (MalformedURLException ex) {
Logger.error("Malformed url exception : " + ex);
}catch (IOException ex) {
Logger.error("IOException : " + ex);
}
}
Re: ZipException: invalid entry compressed size [message #322215 is a reply to message #322212] Fri, 09 November 2007 10:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Alexandre,

What actual URL string is this resolving to? I.e., url.toString looks
like what?

I thought you wanted to scan everything in the jar which means using the
code in AchriveURLConnection as an example, not using it for that
purpose directly. It's only intended to access a particular entry that
actually exists in the archive.


Alexandre Jaquet wrote:
> Here is the code I use :
>
> private void readJarEntries(IJavaProject project, IClasspathEntry
> entry) {
> try {
> URL url = new URL("jar:file:/" +
> entry.getPath().toString() + "!" + removeProtocol());
> ArchiveURLConnection urlConnection = new
> ArchiveURLConnection(url);
> OutputStream output = urlConnection.getOutputStream();
> if (output == null) {
> System.out.println("null");
> }
> System.out.println(url.toString());
> }catch (MalformedURLException ex) {
> Logger.error("Malformed url exception : " + ex);
> }catch (IOException ex) {
> Logger.error("IOException : " + ex);
> }
> }
Re: ZipException: invalid entry compressed size [message #322217 is a reply to message #322215] Fri, 09 November 2007 10:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alexjaquet.gmail.com

Hi again Ed,

"It's only intended to access a particular entry that actually exists in
the archive."

This is what I need, access a single resource from a url.

This is what I do by doing getOutputStream I think I'm doing this rigth.

My url looks like :
Re: ZipException: invalid entry compressed size [message #322218 is a reply to message #322217] Fri, 09 November 2007 10:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alexjaquet.gmail.com

Oups clicked to quickly

url :
jar:file:/W:/EDS-Workspaces/OCS_1.30.2/ocs_install/webDomain /wuiblock/WUI-CDM-Module.jar!/WUI-CDM-Module/oams-profiles/D efault/module/cdm/pageflow/clientrelationship/MyName2.module
Re: ZipException: invalid entry compressed size [message #322225 is a reply to message #322218] Fri, 09 November 2007 11:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Alexandre,

Are you really wanting to output to the jar? Maybe you've corrupted the
jar now... I thought you wanted to read the entry, not write it. You
can just use url.openInputStream() if you want to access the input
stream for this...


Alexandre Jaquet wrote:
> Oups clicked to quickly
>
> url :
> jar:file:/W:/EDS-Workspaces/OCS_1.30.2/ocs_install/webDomain /wuiblock/WUI-CDM-Module.jar!/WUI-CDM-Module/oams-profiles/D efault/module/cdm/pageflow/clientrelationship/MyName2.module
>
Re: ZipException: invalid entry compressed size [message #322246 is a reply to message #322225] Mon, 12 November 2007 02:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alexjaquet.gmail.com

Hi Ed,

By using getInputSream I get the file

thanks
Re: ZipException: invalid entry compressed size [message #322425 is a reply to message #322211] Fri, 16 November 2007 09:40 Go to previous message
Eclipse UserFriend
Originally posted by: Jim.Cooper.sas.com

The most common cause for this that I've seen is by someone using a
fairly recent version of WinZip to create the Jar, instead of using
Java's 'jar' utility.

WinZip has had many changes over the past couple of years, and some of
them are no longer compatible with the zip code in the Java libraries.

For instance, there's an entirely new compression scheme in the latest
WinZip.

The simplest way to 'fix' the problem would be the extract the jar
contents (using whatever works), then re-create it using Java's 'jar'
utility.

Alexandre Jaquet wrote:
> Hi,
>
> I'm trying to use the ArchiveURLConnection class to get a file from
> a compressed jar.
>
> Unfortunatly I got this exception : java.util.zip.ZipException: invalid
> entry compressed size (expected 580 but got 576 bytes)
>
> After reading some ZipEntries.
>
> Any idea why my jar is like corrupted ?
>
> Thanks
Previous Topic:EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor)
Next Topic:Alignment of scroll bars inside a Scrollable control
Goto Forum:
  


Current Time: Thu Jul 17 13:31:05 EDT 2025

Powered by FUDForum. Page generated in 0.08494 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top