diff --git a/src/main/org/apache/tools/ant/taskdefs/condition/AntVersion.java b/src/main/org/apache/tools/ant/taskdefs/condition/AntVersion.java index 017813588..d03304140 100644 --- a/src/main/org/apache/tools/ant/taskdefs/condition/AntVersion.java +++ b/src/main/org/apache/tools/ant/taskdefs/condition/AntVersion.java @@ -77,14 +77,18 @@ public class AntVersion extends Task implements Condition { if (null == atLeast && null == exactly) { throw new BuildException("One of atleast or exactly must be set."); } - try { - if (atLeast != null) { + if (atLeast != null) { + try { new DeweyDecimal(atLeast); - } else { + } catch (NumberFormatException e) { + throw new BuildException("The 'atleast' attribute is not a Dewey Decimal eg 1.1.0 : " + atLeast); + } + } else { + try { new DeweyDecimal(exactly); + } catch (NumberFormatException e) { + throw new BuildException("The 'exactly' attribute is not a Dewey Decimal eg 1.1.0 : " + exactly); } - } catch (NumberFormatException e) { - throw new BuildException("The argument is not a Dewey Decimal eg 1.1.0"); } }