]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
JIRA#FOP-1069: Warn instead or error on invalid property values.
authorPeter Hancock <phancock@apache.org>
Wed, 9 Jan 2013 09:37:11 +0000 (09:37 +0000)
committerPeter Hancock <phancock@apache.org>
Wed, 9 Jan 2013 09:37:11 +0000 (09:37 +0000)
--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
src/java/org/apache/fop/fo/FOValidationEventProducer.xml
src/java/org/apache/fop/fo/FObj.java
src/java/org/apache/fop/layoutmgr/inline/ImageLayout.java
src/java/org/apache/fop/render/ps/PSTextPainter.java
status.xml

index 98b118952e307dd7d3581ac87b9694395a37bb90..c79b2b8030c2e199140295c8d0952907e9d48c78 100644 (file)
@@ -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
index a8b2fffb1fa2fc4e84b69edd82da614f02c30cf8..9f23557c3c1ee54702f3cc6d9858c2f53598b99f 100644 (file)
@@ -26,6 +26,7 @@
   <message key="markerNotUniqueForSameParent">fo:marker "marker-class-name" must be unique for same parent: {mcname}{{locator}}</message>
   <message key="invalidProperty">Invalid property encountered on "{elementName}": {attr}{{locator}}</message>
   <message key="invalidPropertyValue">Invalid property value encountered in {propName}="{propValue}"[: {e}]{{locator}}</message>
+  <message key="warnOnInvalidPropertyValue">Invalid property value encountered in {propName}="{propValue}"[: {e}]{{locator}}</message>  
   <message key="unimplementedFeature">The following feature isn't implemented by Apache FOP, yet: {feature} (on {elementName}){{locator}}</message>
   <message key="missingLinkDestination">Missing attribute on {elementName}: Either external-destination or internal-destination must be specified.{{locator}}</message>
   <message key="markerCloningFailed">Unable to clone subtree of fo:marker (marker-class-name="{markerClassName}") for fo:retrieve-marker.{{locator}}</message>
index b19ccbe20133633965c439236ce967bd53c621b3..a316a22603b4f126d709c1d39392b84efaffe74d 100644 (file)
@@ -133,13 +133,11 @@ public abstract class FObj extends FONode implements Constants {
     private void warnOnUnknownProperties(Attributes attlist, String objName, PropertyList propertyList)
             throws FOPException {
         Map<String, Property> unknowns = propertyList.getUnknownPropertyValues();
-        for (Entry<String, Property> value : unknowns.entrySet()) {
-            String unknownProperty = value.getKey();
+        for (Entry<String, Property> 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());
         }
     }
index c7a4a6a34181aa40ae5c0643eadf8ae5e1f1d5b6..2ef70b15ef3e3f30d9125fa15180b4717a39432d 100644 (file)
@@ -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;
index eb218802632af6d216f16d1c63a065eaffdd7bcc..9abe37ed7574d89e362fcb07d9bda7ad97ec57ed 100644 (file)
@@ -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}.
index bec3c39749e3ba7d5e43c1ef2884426a11376743..efbd518b28545bf39ff3b716c7ee1738c4e6eb06 100644 (file)
@@ -59,6 +59,9 @@
       documents. Example: the fix of marks layering will be such a case when it's done.
     -->
     <release version="FOP Trunk" date="TBD">
+      <action context="Code" dev="PH" type="fix" fixes-bug="FOP-1069" due-to="Robert Meyer">
+        Warn instead or error on invalid property values.
+      </action>
       <action context="Layout" dev="CB" type="fix" fixes-bug="FOP-2174" due-to="Robert Meyer">
         When using SVG drawings, if no content-width and content-height is specified, 72 will
         be used instead of the source-resolution option.