From 91d9b34a7a9a443e58938697d2a5cb43a9475d77 Mon Sep 17 00:00:00 2001 From: Peter Hancock Date: Wed, 9 Jan 2013 09:37:11 +0000 Subject: JIRA#FOP-1069: Warn instead or error on invalid property values. --Thi--s line, and those below, will be ignored-- M src/java/org/apache/fop/render/ps/PSTextPainter.java M src/java/org/apache/fop/layoutmgr/inline/ImageLayout.java M src/java/org/apache/fop/fo/FObj.java M src/java/org/apache/fop/fo/FOValidationEventProducer.java M src/java/org/apache/fop/fo/FOValidationEventProducer.xml M status.xml git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1430746 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/fo/FOValidationEventProducer.java | 14 ++++++++++++++ src/java/org/apache/fop/fo/FOValidationEventProducer.xml | 1 + src/java/org/apache/fop/fo/FObj.java | 8 +++----- src/java/org/apache/fop/layoutmgr/inline/ImageLayout.java | 8 ++++---- src/java/org/apache/fop/render/ps/PSTextPainter.java | 6 ++---- status.xml | 3 +++ 6 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/java/org/apache/fop/fo/FOValidationEventProducer.java b/src/java/org/apache/fop/fo/FOValidationEventProducer.java index 98b118952..c79b2b803 100644 --- a/src/java/org/apache/fop/fo/FOValidationEventProducer.java +++ b/src/java/org/apache/fop/fo/FOValidationEventProducer.java @@ -220,6 +220,20 @@ public interface FOValidationEventProducer extends EventProducer { String propName, String propValue, PropertyException e, Locator loc); + /** + * An invalid property value was encountered. + * @param source the event source + * @param elementName the name of the context node + * @param propName the property name + * @param propValue the property value + * @param e the property exception caused by the invalid value + * @param loc the location of the error or null + * @event.severity WARN + */ + void warnOnInvalidPropertyValue(Object source, String elementName, + String propName, String propValue, PropertyException e, + Locator loc); + /** * A feature is not supported, yet. * @param source the event source diff --git a/src/java/org/apache/fop/fo/FOValidationEventProducer.xml b/src/java/org/apache/fop/fo/FOValidationEventProducer.xml index a8b2fffb1..9f23557c3 100644 --- a/src/java/org/apache/fop/fo/FOValidationEventProducer.xml +++ b/src/java/org/apache/fop/fo/FOValidationEventProducer.xml @@ -26,6 +26,7 @@ fo:marker "marker-class-name" must be unique for same parent: {mcname}{{locator}} Invalid property encountered on "{elementName}": {attr}{{locator}} Invalid property value encountered in {propName}="{propValue}"[: {e}]{{locator}} + Invalid property value encountered in {propName}="{propValue}"[: {e}]{{locator}} The following feature isn't implemented by Apache FOP, yet: {feature} (on {elementName}){{locator}} Missing attribute on {elementName}: Either external-destination or internal-destination must be specified.{{locator}} Unable to clone subtree of fo:marker (marker-class-name="{markerClassName}") for fo:retrieve-marker.{{locator}} diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java index b19ccbe20..a316a2260 100644 --- a/src/java/org/apache/fop/fo/FObj.java +++ b/src/java/org/apache/fop/fo/FObj.java @@ -133,13 +133,11 @@ public abstract class FObj extends FONode implements Constants { private void warnOnUnknownProperties(Attributes attlist, String objName, PropertyList propertyList) throws FOPException { Map unknowns = propertyList.getUnknownPropertyValues(); - for (Entry value : unknowns.entrySet()) { - String unknownProperty = value.getKey(); + for (Entry entry : unknowns.entrySet()) { FOValidationEventProducer producer = FOValidationEventProducer.Provider.get(getUserAgent() .getEventBroadcaster()); - producer.invalidPropertyValue(this, objName, - getAttributeNameForValue(attlist, unknowns.get(unknownProperty), propertyList), - unknownProperty, null, + producer.warnOnInvalidPropertyValue(this, objName, + getAttributeNameForValue(attlist, entry.getValue(), propertyList), entry.getKey(), null, getLocator()); } } diff --git a/src/java/org/apache/fop/layoutmgr/inline/ImageLayout.java b/src/java/org/apache/fop/layoutmgr/inline/ImageLayout.java index c7a4a6a34..2ef70b15e 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/ImageLayout.java +++ b/src/java/org/apache/fop/layoutmgr/inline/ImageLayout.java @@ -179,13 +179,13 @@ public class ImageLayout implements Constants { //Adjust viewport if not explicit if (ipd == -1) { ipd = constrainExtent(cwidth, - props.getInlineProgressionDimension(), (foundNonAuto) - ? props.getContentWidth() : new DefaultLength()); + props.getInlineProgressionDimension(), (foundNonAuto) ? + props.getContentWidth() : new DefaultLength()); } if (bpd == -1) { bpd = constrainExtent(cheight, - props.getBlockProgressionDimension(), (foundNonAuto) - ? props.getContentHeight() : new DefaultLength()); + props.getBlockProgressionDimension(), (foundNonAuto) ? + props.getContentHeight() : new DefaultLength()); } this.clip = false; diff --git a/src/java/org/apache/fop/render/ps/PSTextPainter.java b/src/java/org/apache/fop/render/ps/PSTextPainter.java index eb2188026..9abe37ed7 100644 --- a/src/java/org/apache/fop/render/ps/PSTextPainter.java +++ b/src/java/org/apache/fop/render/ps/PSTextPainter.java @@ -38,10 +38,6 @@ import java.util.List; import org.apache.batik.gvt.font.GVTGlyphVector; import org.apache.batik.gvt.text.TextPaintInfo; import org.apache.batik.gvt.text.TextSpanLayout; - -import org.apache.xmlgraphics.java2d.ps.PSGraphics2D; -import org.apache.xmlgraphics.ps.PSGenerator; - import org.apache.fop.fonts.Font; import org.apache.fop.fonts.FontInfo; import org.apache.fop.fonts.FontMetrics; @@ -50,6 +46,8 @@ import org.apache.fop.fonts.MultiByteFont; import org.apache.fop.svg.NativeTextPainter; import org.apache.fop.util.CharUtilities; import org.apache.fop.util.HexEncoder; +import org.apache.xmlgraphics.java2d.ps.PSGraphics2D; +import org.apache.xmlgraphics.ps.PSGenerator; /** * Renders the attributed character iterator of a {@link org.apache.batik.gvt.TextNode TextNode}. diff --git a/status.xml b/status.xml index bec3c3974..efbd518b2 100644 --- a/status.xml +++ b/status.xml @@ -59,6 +59,9 @@ documents. Example: the fix of marks layering will be such a case when it's done. --> + + Warn instead or error on invalid property values. + When using SVG drawings, if no content-width and content-height is specified, 72 will be used instead of the source-resolution option. -- cgit v1.2.3