Author: jglick Date: Fri Feb 24 16:50:48 2006 New Revision: 380876 URL: http://svn.apache.org/viewcvs?rev=380876&view=rev Log: More helpful diagnostic message for an obscure mistake I once made...
Modified: ant/core/trunk/src/main/org/apache/tools/ant/ComponentHelper.java Modified: ant/core/trunk/src/main/org/apache/tools/ant/ComponentHelper.java URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/ComponentHelper.java?rev=380876&r1=380875&r2=380876&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/ComponentHelper.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/ComponentHelper.java Fri Feb 24 16:50:48 2006 @@ -496,10 +496,14 @@ if (c == null || !(Task.class.isAssignableFrom(c))) { return null; } - Task task = (Task) createComponent(taskType); - if (task == null) { + Object _task = createComponent(taskType); + if (_task == 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); // set default value, can be changed by the user --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]