Browse Source

More helpful diagnostic message for an obscure mistake I once made...

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@380876 13f79535-47bb-0310-9956-ffa450edef68
master
Jesse N. Glick 19 years ago
parent
commit
b3668ba41d
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      src/main/org/apache/tools/ant/ComponentHelper.java

+ 6
- 2
src/main/org/apache/tools/ant/ComponentHelper.java View File

@@ -496,10 +496,14 @@ public class ComponentHelper {
if (c == null || !(Task.class.isAssignableFrom(c))) { if (c == null || !(Task.class.isAssignableFrom(c))) {
return null; return null;
} }
Task task = (Task) createComponent(taskType);
if (task == null) {
Object _task = createComponent(taskType);
if (_task == null) {
return null; return null;
} }
if (!(_task instanceof Task)) {
throw new BuildException("Expected a Task from '" + taskType + "' but got an instance of " + _task.getClass().getName() + " instead");
}
Task task = (Task) _task;
task.setTaskType(taskType); task.setTaskType(taskType);


// set default value, can be changed by the user // set default value, can be changed by the user


Loading…
Cancel
Save