8023565: JPG causes javax.imageio.IIOException: ICC APP2 encoutered without prior JFIF
authormcherkas
Wed, 04 Sep 2013 18:12:49 +0400
changeset 20112 a1c89924203c
parent 20111 7bfa2460d74c
child 20113 ee0defbadbb1
8023565: JPG causes javax.imageio.IIOException: ICC APP2 encoutered without prior JFIF Reviewed-by: bae, vadim
jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java	Wed Sep 04 14:32:13 2013 +0400
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java	Wed Sep 04 18:12:49 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -278,10 +278,11 @@
                         (JFIFMarkerSegment) findMarkerSegment
                         (JFIFMarkerSegment.class, true);
                     if (jfif == null) {
-                        throw new IIOException
-                            ("ICC APP2 encountered without prior JFIF!");
+                        newGuy = new MarkerSegment(buffer);
+                        newGuy.loadData(buffer);
+                    } else {
+                        jfif.addICC(buffer);
                     }
-                    jfif.addICC(buffer);
                     // newGuy remains null
                 } else {
                     newGuy = new MarkerSegment(buffer);