You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2008/02/21 09:19:55 UTC

svn commit: r629714 - /xmlgraphics/fop/branches/fop-0_93/src/java/org/apache/fop/image/JpegImage.java

Author: jeremias
Date: Thu Feb 21 00:19:53 2008
New Revision: 629714

URL: http://svn.apache.org/viewvc?rev=629714&view=rev
Log:
Hotfix for 0.93:
Avoid NPE when ICC Profile is present but can, for some reason, not be loaded.

Modified:
    xmlgraphics/fop/branches/fop-0_93/src/java/org/apache/fop/image/JpegImage.java

Modified: xmlgraphics/fop/branches/fop-0_93/src/java/org/apache/fop/image/JpegImage.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-0_93/src/java/org/apache/fop/image/JpegImage.java?rev=629714&r1=629713&r2=629714&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-0_93/src/java/org/apache/fop/image/JpegImage.java (original)
+++ xmlgraphics/fop/branches/fop-0_93/src/java/org/apache/fop/image/JpegImage.java Thu Feb 21 00:19:53 2008
@@ -24,6 +24,7 @@
 
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.io.output.ByteArrayOutputStream;
+
 import org.apache.fop.util.CMYKColorSpace;
 
 /**
@@ -188,18 +189,18 @@
             }
             try {
                 iccProfile = ICC_Profile.getInstance(iccStream.toByteArray());
+                if (iccProfile.getNumComponents() != this.colorSpace.getNumComponents()) {
+                    log.warn("The number of components of the ICC profile ("
+                            + iccProfile.getNumComponents() 
+                            + ") doesn't match the image ("
+                            + this.colorSpace.getNumComponents()
+                            + "). Ignoring the ICC color profile.");
+                    this.iccProfile = null;
+                }
             } catch (IllegalArgumentException iae) {
                 log.warn("An ICC profile is present but it is invalid (" 
                         + iae.getMessage() + "). The color profile will be ignored. (" 
                         + this.getOriginalURI() + ")");
-            }
-            if (iccProfile.getNumComponents() != this.colorSpace.getNumComponents()) {
-                log.warn("The number of components of the ICC profile ("
-                        + iccProfile.getNumComponents() 
-                        + ") doesn't match the image ("
-                        + this.colorSpace.getNumComponents()
-                        + "). Ignoring the ICC color profile.");
-                this.iccProfile = null;
             }
         } else if (this.colorSpace == null) {
             log.error("ColorSpace not specified for JPEG image");



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org