Comment 4 for bug 1197059

Revision history for this message
Fergus Nelson (fergus-8) wrote :

Something like this. Yes I can still reproduce, but have moved to pngs to get past it.

URL objUrl = this.getClass().getClassLoader().getResource("images/image1.jpg");
byte[] objBytes = Files.readAllBytes(Paths.get(objUrl.toURI()));
try (ByteArrayInputStream bais = new ByteArrayInputStream(imageData)) {
            BufferedImage image = ImageIO.read(bais); //>> this is where the error occurs.
            return image;
        } catch (IOException e) {
            LOG.error(null, "Failed to create buffered image", e);
            throw new RuntimeException(e);
        }