From: Luis Bernardo Date: Thu, 21 Feb 2013 00:45:28 +0000 (+0000) Subject: FOP-2183: Use event producer when Colour Profile in PNG Image is bad; patch submitted... X-Git-Tag: fop-2_0~227 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d0d7e25d98cd1509e8433782af336e93bb02f1b8;p=xmlgraphics-fop.git FOP-2183: Use event producer when Colour Profile in PNG Image is bad; patch submitted by Simon Steiner git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1448483 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/xmlgraphics-commons-svn-trunk.jar b/lib/xmlgraphics-commons-svn-trunk.jar index 91648b9ff..453ba2e66 100644 Binary files a/lib/xmlgraphics-commons-svn-trunk.jar and b/lib/xmlgraphics-commons-svn-trunk.jar differ diff --git a/src/java/org/apache/fop/ResourceEventProducer.java b/src/java/org/apache/fop/ResourceEventProducer.java index 926b7c92b..18293ff06 100644 --- a/src/java/org/apache/fop/ResourceEventProducer.java +++ b/src/java/org/apache/fop/ResourceEventProducer.java @@ -152,4 +152,12 @@ public interface ResourceEventProducer extends EventProducer { * @event.severity ERROR */ void catalogResolverNotCreated(Object source, String message); + + /** + * Warning in an image. + * @param source the event source + * @param message warning + * @event.severity WARN + */ + void imageWarning(Object source, String message); } diff --git a/src/java/org/apache/fop/ResourceEventProducer.xml b/src/java/org/apache/fop/ResourceEventProducer.xml index 0ea34af2c..d9b337dae 100644 --- a/src/java/org/apache/fop/ResourceEventProducer.xml +++ b/src/java/org/apache/fop/ResourceEventProducer.xml @@ -20,6 +20,7 @@ [ (See position {loc})| (See {#gatherContextInfo})| (No context info available)] Image not found.[ URI: {uri}.]{{locator}} Image not available.[ URI: {uri}.] Reason:[ {reason}][ {e}]{{locator}} + Image warning.[ URI: {uri}.] Reason:[ {message}][ {e}]{{locator}} I/O error while loading image.[ URI: {uri}.][ Reason: {ioe}]{{locator}} The intrinsic dimensions of an instream-foreign-object could not be determined.{{locator}} Error while handling URI: {uri}. Reason: {e}{{locator}} diff --git a/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java b/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java index 2205aea4c..12dd46c20 100644 --- a/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java +++ b/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java @@ -155,10 +155,17 @@ public abstract class AbstractIFPainter implements context.putHints(hints); ImageFlavor[] flavors = imageHandlerRegistry.getSupportedFlavors(context); + info.getCustomObjects().put("warningincustomobject", true); org.apache.xmlgraphics.image.loader.Image img = manager.getImage( info, flavors, hints, sessionContext); + if (info.getCustomObjects().get("warning") != null) { + ResourceEventProducer eventProducer = ResourceEventProducer.Provider.get( + getUserAgent().getEventBroadcaster()); + eventProducer.imageWarning(this, (String)info.getCustomObjects().get("warning")); + } + try { drawImage(img, rect, context); } catch (IOException ioe) {