Solved

"Invalid Block Type" exception message

Posted on 2006-11-16
9
769 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 300 total points
ID: 17961329
Make sure the file is not corrupt by running zcat or something against it
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 

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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

696 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