Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception

 
Ahmed Kotb
Ranch Hand
Posts: 35
Google Web Toolkit Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

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

Can anyone help please?
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
 
Ahmed Kotb
Ranch Hand
Posts: 35
Google Web Toolkit Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no File is not corrupted , i tried to extract it with winrare and it is extracted successfully
 
Henry Wong
author
Marshal
Pie
Posts: 20894
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ahmed Kotb
Ranch Hand
Posts: 35
Google Web Toolkit Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
to be with me this is the code i use

 
Ahmed Kotb
Ranch Hand
Posts: 35
Google Web Toolkit Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How large is "large"? If I remember correctly, Java's ZIP classes didn't support ZIP files of 4GB or larger until Java 7.
 
Ahmed Kotb
Ranch Hand
Posts: 35
Google Web Toolkit Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 35
Google Web Toolkit Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to All

I found the Error

The Error was in Setting File Type Before Downloading it .
 
Rob Spoor
Sheriff
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic