Google+ Badge

Tuesday, September 21, 2010

When all else fails upgrade the JRE

Another team was having issues with some image manipulation so they asked me to help out. They had traced it down to some code doing an image rotation. Code was very simple so no obvious problem. The code was happening in the servelet, get a TIFF, convert to PNG, scale it down and rotate it if the rotation flag on original TIFF was set.

Special TIFF (aren't they all?) so we use the 3rd party library from Acordex to load them and same them as a PNG. Everything there was working fine so I took the code out of the servlet and made a stand alone Java project. It worked perfectly. I wrote out the images to a temp directory at various stages.

I then created a JAR file with the test code so we could run it on the VM using same set up as the Tomcat based servlet. JAR did not run because I cheated to pull the 3rd party code from another JAR. Grabbed FatJar for Eclipse and built a new JAR with all the stuff I needed.

Worked like a champ on the machine of the developer I was helping. Put it on the customer identical VM and it did not work. Everything up to the rotate was fine but the rotate produced nothing for an image. Both I and the developer running JDK 1.6 update 21, the customer VM was update 6. Updated the customer VM to update 21 and it ran just fine. Did some searching for known rotate issues but did not find any. Figured the we have a fix for the customer so might as well let it go at that.

Update 6 is pretty old, don't think the custom is going to fight the upgrade. Anything below 19 is pretty suspect due to security issues anyway. I hate to blame the JRE first, always figure it has to be my code at fault especially when I am not doing anything out of the ordinary. Best be is to create a small test program if possible to narrow things down. Glad this one is off the books.