From 07b3f5e912244d7a3ad3f4cab58e59c5ec886852 Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Mon, 23 Apr 2007 14:41:10 +0000 Subject: [PATCH] Print out the name of the attribute and its value when there is a conversion error git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@531483 13f79535-47bb-0310-9956-ffa450edef68 --- .../tools/ant/taskdefs/condition/AntVersion.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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"); } }