aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorLuis Bernardo <lbernardo@apache.org>2013-06-18 23:04:16 +0000
committerLuis Bernardo <lbernardo@apache.org>2013-06-18 23:04:16 +0000
commitcf4a154c989c6f8200d38336f6a8eba3c84602c6 (patch)
tree58140ea664c577dcbad63b35dc0e84000fdcea75 /src/java
parentdbe184f3847d388769262d588a394e188c78cd92 (diff)
downloadxmlgraphics-fop-cf4a154c989c6f8200d38336f6a8eba3c84602c6.tar.gz
xmlgraphics-fop-cf4a154c989c6f8200d38336f6a8eba3c84602c6.zip
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
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/fop/traits/SpaceVal.java10
1 files changed, 10 insertions, 0 deletions
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);
}