diff --git a/imageio/imageio-jpeg/src/main/java/com/twelvemonkeys/imageio/plugins/jpeg/JPEGImageReader.java b/imageio/imageio-jpeg/src/main/java/com/twelvemonkeys/imageio/plugins/jpeg/JPEGImageReader.java index d3523ad3a..14c56be1d 100644 --- a/imageio/imageio-jpeg/src/main/java/com/twelvemonkeys/imageio/plugins/jpeg/JPEGImageReader.java +++ b/imageio/imageio-jpeg/src/main/java/com/twelvemonkeys/imageio/plugins/jpeg/JPEGImageReader.java @@ -888,20 +888,21 @@ Frame getSOF() throws IOException { throw new IIOException("No SOF segment in stream"); } + private Application lastAppSegment(int marker, String identifier) throws IOException { + List appSegments = getAppSegments(marker, identifier); + return appSegments.isEmpty() ? null : appSegments.get(appSegments.size() - 1); + } + AdobeDCT getAdobeDCT() throws IOException { - List adobe = getAppSegments(JPEG.APP14, "Adobe"); - return adobe.isEmpty() ? null : (AdobeDCT) adobe.get(0); + return (AdobeDCT) lastAppSegment(JPEG.APP14, "Adobe"); } JFIF getJFIF() throws IOException{ - List jfif = getAppSegments(JPEG.APP0, "JFIF"); - return jfif.isEmpty() ? null : (JFIF) jfif.get(0); - + return (JFIF) lastAppSegment(JPEG.APP0, "JFIF"); } JFXX getJFXX() throws IOException { - List jfxx = getAppSegments(JPEG.APP0, "JFXX"); - return jfxx.isEmpty() ? null : (JFXX) jfxx.get(0); + return (JFXX) lastAppSegment(JPEG.APP0, "JFXX"); } private EXIF getExif() throws IOException { diff --git a/imageio/imageio-jpeg/src/main/java/com/twelvemonkeys/imageio/plugins/jpeg/JPEGImageReaderSpi.java b/imageio/imageio-jpeg/src/main/java/com/twelvemonkeys/imageio/plugins/jpeg/JPEGImageReaderSpi.java index 7efc00c96..49b864fa8 100644 --- a/imageio/imageio-jpeg/src/main/java/com/twelvemonkeys/imageio/plugins/jpeg/JPEGImageReaderSpi.java +++ b/imageio/imageio-jpeg/src/main/java/com/twelvemonkeys/imageio/plugins/jpeg/JPEGImageReaderSpi.java @@ -52,7 +52,7 @@ * @version $Id: JPEGImageReaderSpi.java,v 1.0 24.01.11 22.12 haraldk Exp$ */ public final class JPEGImageReaderSpi extends ImageReaderSpiBase { - protected ImageReaderSpi delegateProvider; + ImageReaderSpi delegateProvider; /** * Constructor for use by {@link javax.imageio.spi.IIORegistry} only.