From f599537b1b64559fcdd4ce25d2d7ef70a7a09aa3 Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Fri, 14 Jul 2006 20:13:28 +0000 Subject: [PATCH] Bonus extra diagnostics. Handy when the uri is ${unexpanded} git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@422011 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tools/ant/taskdefs/Definer.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/Definer.java b/src/main/org/apache/tools/ant/taskdefs/Definer.java index df5217e46..265a13d31 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Definer.java +++ b/src/main/org/apache/tools/ant/taskdefs/Definer.java @@ -201,16 +201,23 @@ public abstract class Definer extends DefBase { //we are in an antlib, in which case the resource name is determined //automatically. //NB: URIs in the ant core package will be "" at this point. - if (getURI()!=null && getURI().startsWith(MagicNames.ANTLIB_PREFIX)) { + if (getURI() == null) { + throw new BuildException( + "name, file or resource attribute of " + + getTaskName() + " is undefined", + getLocation()); + } + + if (getURI().startsWith(MagicNames.ANTLIB_PREFIX)) { //convert the URI to a resource String uri1 = getURI(); setResource(makeResourceFromURI(uri1)); } else { - throw new BuildException( - "name, file or resource attribute of " - + getTaskName() + " is undefined", getLocation()); - } + throw new BuildException( + "Only antlib URIs can be located from the URI alone," + + "not the URI " + getURI()); } + } if (name != null) { if (classname == null) {