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 2006/09/11 11:55:43 UTC

svn commit: r442148 - /xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java

Author: jeremias
Date: Mon Sep 11 02:55:42 2006
New Revision: 442148

URL: http://svn.apache.org/viewvc?view=rev&rev=442148
Log:
Missed the other source of "getValue() called on AUTO length" last time.
Improved reporting where possible.

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java?view=diff&rev=442148&r1=442147&r2=442148
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java Mon Sep 11 02:55:42 2006
@@ -59,6 +59,12 @@
             return new LengthRangeProperty();
         }
 
+        private boolean isNegativeLength(Length len) {
+            return ((len instanceof PercentLength
+                        && ((PercentLength) len).getPercentage() < 0)
+                    || (len.isAbsolute() && len.getValue() < 0));
+        }
+        
         /**
          * @see CompoundPropertyMaker#convertProperty
          */        
@@ -74,11 +80,10 @@
                     || this.propId == PR_INLINE_PROGRESSION_DIMENSION) {
                 Length len = p.getLength();
                 if (len != null) {
-                    if ((len instanceof PercentLength
-                                && ((PercentLength) len).getPercentage() < 0)
-                            || (len.isAbsolute() && len.getValue() < 0)) {
-                        log.warn("Replaced negative value for " + getName()
-                                + " with 0mpt");
+                    if (isNegativeLength(len)) {
+                        log.warn(FObj.decorateWithContextInfo(
+                                "Replaced negative value (" + len + ") for " + getName()
+                                + " with 0mpt", fo));
                         p = new FixedLength(0);
                     }
                 }
@@ -98,10 +103,8 @@
                     || this.propId == PR_INLINE_PROGRESSION_DIMENSION) {
                 Length len = subproperty.getLength();
                 if (len != null) {
-                    if ((len instanceof PercentLength
-                                && ((PercentLength) len).getPercentage() < 0)
-                            || len.getValue() < 0) {
-                        log.warn("Replaced negative value for " + getName()
+                    if (isNegativeLength(len)) {
+                        log.warn("Replaced negative value (" + len + ") for " + getName()
                                 + " with 0mpt");
                         val.setComponent(subpropertyId,
                                 new FixedLength(0), false);
@@ -274,11 +277,12 @@
         return this.optimum;
     }
 
+    /** @see java.lang.Object#toString() */
     public String toString() {
-        return "LengthRange[" +
-        "min:" + getMinimum(null).getObject() + 
-        ", max:" + getMaximum(null).getObject() + 
-        ", opt:" + getOptimum(null).getObject() + "]";
+        return "LengthRange["
+            + "min:" + getMinimum(null).getObject() 
+            + ", max:" + getMaximum(null).getObject() 
+            + ", opt:" + getOptimum(null).getObject() + "]";
     }
 
     /**



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