?
Solved

"Invalid Block Type" exception message

Posted on 2006-11-16
9
Medium Priority
?
784 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 900 total points
ID: 17961329
Make sure the file is not corrupt by running zcat or something against it
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Suggested Courses
Course of the Month12 days, 6 hours left to enroll

752 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