Comment 6 for bug 1197059

Revision history for this message
Adam Dingle (adam-yorba) wrote :

Also, I expanded the Java code snippet you posted into a full program:

===
import java.awt.image.BufferedImage;
import java.io.*;
import java.net.*;
import java.nio.file.*;
import javax.imageio.ImageIO;

public class Hello {
    void read() {
        URL objUrl = this.getClass().getClassLoader().getResource("image1.jpg");
        try {
            byte[] objBytes = Files.readAllBytes(Paths.get(objUrl.toURI()));
            ByteArrayInputStream bais = new ByteArrayInputStream(objBytes);
            BufferedImage image = ImageIO.read(bais); //>> this is where the error occurs.
            System.out.println("success");
        } catch (Exception e) {
            System.out.println("Failed to create buffered image");
        }
    }

    public static void main(String[] args) {
        new Hello().read();
    }
}
===

When I run this it prints "success", so this isn't reproducing the crash for me either.