]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Don't log a stacktrace when a JPEG is encountered that has a bad ICC profile and...
authorJeremias Maerki <jeremias@apache.org>
Wed, 28 Mar 2007 20:28:23 +0000 (20:28 +0000)
committerJeremias Maerki <jeremias@apache.org>
Wed, 28 Mar 2007 20:28:23 +0000 (20:28 +0000)
Log the event when a CMYK JPEG with an APPE marker is encountered.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@523452 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/image/JpegImage.java

index 820a728f982e97951af585d53a46919db29f2ecf..3ad745281655a5b1bb6691a4d0c1b56aaa8341b0 100644 (file)
@@ -189,15 +189,20 @@ public class JpegImage extends AbstractFopImage {
             }
             try {
                 iccProfile = ICC_Profile.getInstance(iccStream.toByteArray());
-            } catch (Exception e) {
-                log.error("Invalid ICC profile: " + e, e);
-                return false;
+            } catch (IllegalArgumentException iae) {
+                log.warn("An ICC profile is present but it is invalid (" 
+                        + iae.getMessage() + "). The color profile will be ignored. (" 
+                        + this.getOriginalURI() + ")");
             }
         } else if (this.colorSpace == null) {
             log.error("ColorSpace not specified for JPEG image");
             return false;
         }
         if (hasAPPEMarker && this.colorSpace.getType() == ColorSpace.TYPE_CMYK) {
+            if (log.isDebugEnabled()) {
+                log.debug("JPEG has an Adobe APPE marker. Note: CMYK Image will be inverted. ("
+                        + this.getOriginalURI() + ")");
+            }
             this.invertImage = true;
         }
         return true;