Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

"Invalid Block Type" exception message

Posted on 2006-11-16
9
Medium Priority
?
800 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
Technology Partners: 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

604 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