mercredi 28 janvier 2015

ImageIO.Read(...) returning null platform dependant

The following java snippet correctly returns an image object on a local instance of RHEL:



URL url = new URL("http://ift.tt/1DaSxQq");
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
BufferedImage image = ImageIO.read(conn.getInputStream());


When I run the same on AWS Linux, image remains null. For other image URLs both RHEL and AWS linux work ok, so this is an example of a JPG for which AWS linux is not working.


Both environments are using the same JVM:



java version "1.7.0_75"
OpenJDK Runtime Environment (rhel-2.5.4.0.el6_6-x86_64 u75-b13)
OpenJDK 64-Bit Server VM (build 24.75-b04, mixed mode)


vs.



java version "1.7.0_75"
OpenJDK Runtime Environment (amzn-2.5.4.0.53.amzn1-x86_64 u75-b13)
OpenJDK 64-Bit Server VM (build 24.75-b04, mixed mode)


I am a total loss to explain the difference in behaviour. Might anyone have any suggestions?





Aucun commentaire:

Enregistrer un commentaire