views:

236

answers:

1

Hi!

I've created a servlet that changes the binaries of a SWF file and output it to the user. The SWF is compressed by ZLIB by default. Then I inflate, change the binaries, deflate and output the result.

Everything was running right on a Windows Server 2008 (also in 2003). Currently, we need change the server to Linux, and then, this servlet is somehow outputing a corrupted SWF File... what could be the problem? What intrigues me more is that there is no difference between the Windows and Linux servlet versions.

Is there any undocumented linux specific behaviour for the java.util.zip package?


My Windows Server is (where the servlet is working):

  • Windows Server 2008 (6.0 - x86)
  • Apache 2.2.11
  • Tomcat 6.0.16.0 Java
  • JDK 1.6.0_12-b04


My CentOS Server is (where te servlet doesn't work)

  • CentOS 5.4 (2.6.18-164.15.1.el5 - i386)
  • Apache 2.2.3
  • Tomcat 6.0.16.0
  • Java JDK 1.6.0_12-b04

Any lead would be appreciated! Cheers, CaioToOn!

+1  A: 

It's difficult to say more without seeing some code and/or examples of how your SWF files are being "corrupted". To answer your question directly, I can't think of any difference in principle between the zip library on the two platforms. But some things to think about:

  • things that could be different include the default character encoding (are you somewhere converting a string to bytes, which under Linux accidentally puts illegal characters into the file) -- though I admit that off the top of my head, I can't just think where this would be in your particular scenario
  • what other libraries are you relying on?
  • get some logging into your servlet and see what the actual file data looks like at the various stages through the process...
  • in a similar vein, can you elaborate on the way in which the file is "corrupted"-- what error messages do you get, if any? when you compare a "good" file and a "corrupted" file in your hex editor, what difference is there?
Neil Coffey
Thats it! I was inputing Strings into the SWF file. In Windows worked fine, but the default charset of Linux was different! Just specify the Charset and everything works fine now!Thank you very much, Neil!
CaioToOn