This fails (also when image is loaded from local file system):
@Test
public final void imageIofailsToLoad5MbImage() throws IOException {
final String snakeRiver = "http://upload.wikimedia.org/wikipedia/commons/2/2d/Snake_River_%285mb%29.jpg";
BufferedImage img = ImageIO.read(new URL(snakeRiver));
assertNotNull(img);
}
This passes:
@Test
public final void canLoad4MbImages() throws IOException {
final String map = "http://upload.wikimedia.org/wikipedia/commons/1/1e/Caerte_van_Oostlant_4MB.jpg";
final String aero = "http://upload.wikimedia.org/wikipedia/commons/c/c2/C-141_Starlifter_contrail_crop1.png";
for (String fileUrl : Arrays.asList(aero,map)) {
BufferedImage img = ImageIO.read(new URL(fileUrl));
assertNotNull(img);
}
}
My system:
Xubuntu 12.04
Uname - a:
Linux 3.2.0-26-generic #41-Ubuntu SMP Thu Jun 14 17:49:24 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Java version
java version "1.7.0_03"
OpenJDK Runtime Environment (IcedTea7 2.1.1pre) (7~u3-2.1.1~pre1-1ubuntu3)
OpenJDK 64-Bit Server VM (build 22.0-b10, mixed mode)
Java exception
java.lang.IllegalArgumentException: Can't load standard profile: sRGB.pf
at java.awt.color.ICC_Profile$2.run(ICC_Profile.java:931)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.color.ICC_Profile.getStandardProfile(ICC_Profile.java:924)
at java.awt.color.ICC_Profile.getDeferredInstance(ICC_Profile.java:1071)
at java.awt.color.ICC_Profile.getInstance(ICC_Profile.java:843)
at java.awt.color.ColorSpace.getInstance(ColorSpace.java:298)
at java.awt.color.ICC_ColorSpace.fromRGB(ICC_ColorSpace.java:215)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.setImageData(JPEGImageReader.java:635)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readImageHeader(Native Method)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readNativeHeader(JPEGImageReader.java:550)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.checkTablesOnly(JPEGImageReader.java:295)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.gotoImage(JPEGImageReader.java:427)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readHeader(JPEGImageReader.java:543)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:986)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:966)
at javax.imageio.ImageIO.read(ImageIO.java:1448)
at javax.imageio.ImageIO.read(ImageIO.java:1400)
at com.mafunzu.justcook.io.MyImageSlowFixture.imageIofailsToLoad5MbImage(MyImageSlowFixture.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Cheers
Peter
this 5Mb file works as expected:
http:// upload. wikimedia. org/wikipedia/ commons/ e/eb/Franco- Prussian_ War-_Illustrate d_London_ News%2C_ September_ 17%2C_1870_ -_Discussing_ the_War_ in_a_Paris_ Caf%C3% A9_-_left. PNG