From: Luis Bernardo Date: Tue, 18 Jun 2013 23:04:16 +0000 (+0000) Subject: FOP-2246: Exception java.lang.IllegalArgumentException: min (1650) > opt (0); changes... X-Git-Tag: fop-2_0~199 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=cf4a154c989c6f8200d38336f6a8eba3c84602c6;p=xmlgraphics-fop.git FOP-2246: Exception java.lang.IllegalArgumentException: min (1650) > opt (0); changes to avoid exception and default to "reasonable" values if no invalid value was explicitly provided. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1494364 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/traits/SpaceVal.java b/src/java/org/apache/fop/traits/SpaceVal.java index f9f5c4991..1cefd62f7 100644 --- a/src/java/org/apache/fop/traits/SpaceVal.java +++ b/src/java/org/apache/fop/traits/SpaceVal.java @@ -59,6 +59,16 @@ public class SpaceVal { int min = spaceprop.getMinimum(context).getLength().getValue(context); int opt = spaceprop.getOptimum(context).getLength().getValue(context); int max = spaceprop.getMaximum(context).getLength().getValue(context); + // if a value is not set defaults to zero + if (min > max && max == 0) { + max = opt > min ? opt : min; + } + if (min > opt && opt == 0) { + opt = (min + max) / 2; + } + if (opt > max && max == 0) { + max = opt; + } return MinOptMax.getInstance(min, opt, max); }