From cf4a154c989c6f8200d38336f6a8eba3c84602c6 Mon Sep 17 00:00:00 2001 From: Luis Bernardo Date: Tue, 18 Jun 2013 23:04:16 +0000 Subject: [PATCH] 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 --- src/java/org/apache/fop/traits/SpaceVal.java | 10 ++++++++++ 1 file changed, 10 insertions(+) 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); } -- 2.39.5