Solved

"Invalid Block Type" exception message

Posted on 2006-11-16
9
755 Views
Last Modified: 2008-03-17
I got "Invalid Block Type" exception message in my program. I'm not sure what this is. Could somebody please advice?

The code is actually fine when I run it in my local machine (windows).
It retrieves the data just fine.
But when I run it in the server (linux), it gives me this exception.

Thanks.

-----------------------------------------------------------------------------------------------------

GZIPInputStream gzip_in_stream = null;
BufferedOutputStream destination_out_stream = new BufferedOutputStream(
   new FileOutputStream(weatherFile), BUF_SIZE);
   byte[] input_buffer = new byte[BUF_SIZE];
int byteLength = 0;            
 
InputStream tempStream = ftpClient.retrieveFileStream(zippedFile);
                  
gzip_in_stream = new GZIPInputStream(
new BufferedInputStream(tempStream));

while ( (byteLength = gzip_in_stream.read(input_buffer, 0, BUF_SIZE)) > 0 )
{
destination_out_stream.write(input_buffer, 0, byteLength);      
}
 
destination_out_stream.flush(); // Ensure all the data is written to the output.
destination_out_stream.close();
gzip_in_stream.close();      

0
Comment
Question by:rnicholus
  • 5
  • 4
9 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 17961190
Try

while ( (byteLength = gzip_in_stream.read(input_buffer, 0, BUF_SIZE)) > -1 )
0
 

Author Comment

by:rnicholus
ID: 17961306
It gives me:

"incomplete dynamic bit lengths tree"
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 300 total points
ID: 17961329
Make sure the file is not corrupt by running zcat or something against it
0
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 

Author Comment

by:rnicholus
ID: 17966257
I do "zcat [filename]" and then it prints the contents of the file in the console and it doesn't give me any warning or error.
I've never used zcat before. Is this what supposed to happen?

Thanks
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17966270
Yep. I think you can safely take it that the file's not corrupt from that. No further ideas at the moment although you might check that this is not a known bug
0
 

Author Comment

by:rnicholus
ID: 17967413
Now it gives me "corrupt gzip trailer" on these lines below.

------------------------------
while ( (byteLength = gzip_in_stream.read(input_buffer, 0, BUF_SIZE)) > 0 )
{System.out.println("** test **");
destination_out_stream.write(input_buffer, 0, byteLength);      
}
------------------------------

It seems that it goes inside the while loop printing the String "** test **" before it gives me the error message "corrupt gzip trailer".
0
 

Author Comment

by:rnicholus
ID: 17967723
I've also tried using ">-1" instead of ">0".

Also I've tried using zcat again.
0
 

Author Comment

by:rnicholus
ID: 18072774
Doing these below seem to solve the problem:

ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);

I will give points for CEHJ for the assistance in finding the answer.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 18075994
:-)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
servlet filter example 37 72
tomcat startup error 5 106
jsp error 6 26
Running JavaFX on the Raspberry Pi 27 47
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This video teaches viewers about errors in exception handling.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question