Return-Path: Delivered-To: apmail-ant-notifications-archive@minotaur.apache.org Received: (qmail 50783 invoked from network); 7 May 2009 10:58:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 May 2009 10:58:52 -0000 Received: (qmail 47740 invoked by uid 500); 7 May 2009 10:58:52 -0000 Delivered-To: apmail-ant-notifications-archive@ant.apache.org Received: (qmail 47698 invoked by uid 500); 7 May 2009 10:58:52 -0000 Mailing-List: contact notifications-help@ant.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ant.apache.org Delivered-To: mailing list notifications@ant.apache.org Received: (qmail 47689 invoked by uid 99); 7 May 2009 10:58:52 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 May 2009 10:58:52 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 May 2009 10:58:50 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id F045523889BB; Thu, 7 May 2009 10:58:29 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r772606 - /ant/core/trunk/src/main/org/apache/tools/ant/IntrospectionHelper.java Date: Thu, 07 May 2009 10:58:29 -0000 To: notifications@ant.apache.org From: bodewig@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090507105829.F045523889BB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: bodewig Date: Thu May 7 10:58:29 2009 New Revision: 772606 URL: http://svn.apache.org/viewvc?rev=772606&view=rev Log: special handling of IllegalArgumentExceptions in attribute setters for better error messages. PR 47129 Modified: ant/core/trunk/src/main/org/apache/tools/ant/IntrospectionHelper.java Modified: ant/core/trunk/src/main/org/apache/tools/ant/IntrospectionHelper.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/IntrospectionHelper.java?rev=772606&r1=772605&r2=772606&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/IntrospectionHelper.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/IntrospectionHelper.java Thu May 7 10:58:29 2009 @@ -1139,6 +1139,10 @@ try { m.invoke(parent, new Object[] { new Long(StringUtils.parseHumanSizes(value)) }); + } catch (NumberFormatException e) { + throw new BuildException("Can't assign non-numeric" + + " value '" + value + "' to" + + " attribute " + attrName); } catch (InvocationTargetException e) { throw e; } catch (IllegalAccessException e) { @@ -1184,6 +1188,17 @@ p.setProjectReference(attribute); } m.invoke(parent, new Object[] {attribute}); + } catch (InvocationTargetException e) { + Throwable cause = e.getCause(); + if (cause instanceof IllegalArgumentException) { + throw new BuildException("Can't assign value '" + value + + "' to attribute " + attrName + + ", reason: " + + cause.getClass() + + " with message '" + + cause.getMessage() + "'"); + } + throw e; } catch (InstantiationException ie) { throw new BuildException(ie); }