From: Jeremias Maerki Date: Thu, 21 Feb 2008 08:19:53 +0000 (+0000) Subject: Hotfix for 0.93: X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fremotes%2Ffop-0_93;p=xmlgraphics-fop.git Hotfix for 0.93: Avoid NPE when ICC Profile is present but can, for some reason, not be loaded. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_93@629714 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/image/JpegImage.java b/src/java/org/apache/fop/image/JpegImage.java index d67816cff..8318d0d25 100644 --- a/src/java/org/apache/fop/image/JpegImage.java +++ b/src/java/org/apache/fop/image/JpegImage.java @@ -24,6 +24,7 @@ import java.awt.color.ICC_Profile; import org.apache.commons.io.IOUtils; import org.apache.commons.io.output.ByteArrayOutputStream; + import org.apache.fop.util.CMYKColorSpace; /** @@ -188,19 +189,19 @@ public class JpegImage extends AbstractFopImage { } 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"); return false;