aspose file tools*
The moose likes Java in General and the fly likes Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Exception" Watch "Exception" New topic
Author

Exception

Ahmed Kotb
Ranch Hand

Joined: Apr 29, 2011
Posts: 35

Hi All,

When trying to extract ZIP file , encountered the following Exception [java.util.zip.ZipException : invalid block type]

Can anyone help please?


Ahmed Kotb
Software Developer
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

I believe your file is corrupted.


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
Ahmed Kotb
Ranch Hand

Joined: Apr 29, 2011
Posts: 35

no File is not corrupted , i tried to extract it with winrare and it is extracted successfully
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18997
    
  40

Ahmed Kotb wrote:no File is not corrupted , i tried to extract it with winrare and it is extracted successfully


WinRar supports many many different formats -- including the copyrighted rar format. If the cause is because you are using a format that isn't support, I don't know what to tell you.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Ahmed Kotb
Ranch Hand

Joined: Apr 29, 2011
Posts: 35

to be with me this is the code i use

Ahmed Kotb
Ranch Hand

Joined: Apr 29, 2011
Posts: 35


Henry Wong wrote:
WinRar supports many many different formats -- including the copyrighted rar format. If the cause is because you are using a format that isn't support, I don't know what to tell you.




File Format is ZIP , and after extraction i try to rename it as above in the code.

I used this method with Small files and it worked good , but when dealing with large files it throws that exception.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19762
    
  20

How large is "large"? If I remember correctly, Java's ZIP classes didn't support ZIP files of 4GB or larger until Java 7.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Ahmed Kotb
Ranch Hand

Joined: Apr 29, 2011
Posts: 35

when downloading that file with FileZilla the extraction method working well, so i guess that the problem in the method which i am using for downloading(retrieveFile(String remoteFileName, FileOutputStream fos)) ...
I am using Apache Library (commons-net.jar), is there any problems for that library ?
Ahmed Kotb
Ranch Hand

Joined: Apr 29, 2011
Posts: 35

Thanks to All

I found the Error

The Error was in Setting File Type Before Downloading it .
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19762
    
  20

Ah yes, the dreaded ASCII / binary download problem. Downloading a binary file (like ZIP files) as if they were text will corrupt the file. That's what happened to you. When using binary or automatic for transferring you won't have this problem.
 
Consider Paul's rocket mass heater.
 
subject: Exception