From 8f70bc2a919459c49c1977d91551f43819063954 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Thu, 11 Jul 2002 07:46:34 +0000 Subject: [PATCH] Allow all tasks to be used outside of targets. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273088 13f79535-47bb-0310-9956-ffa450edef68 --- .../tools/ant/helper/ProjectHelperImpl.java | 48 +++---------------- 1 file changed, 6 insertions(+), 42 deletions(-) diff --git a/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java b/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java index a954ab9c6..81fea650d 100644 --- a/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java +++ b/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java @@ -502,24 +502,20 @@ public class ProjectHelperImpl extends ProjectHelper { * or a data type definition */ public void startElement(String name, AttributeList attrs) throws SAXParseException { - if (name.equals("taskdef")) { - handleTaskdef(name, attrs); - } else if (name.equals("typedef")) { - handleTypedef(name, attrs); - } else if (name.equals("property")) { - handleProperty(name, attrs); - } else if (name.equals("target")) { + if (name.equals("target")) { handleTarget(name, attrs); } else if (helperImpl.project.getDataTypeDefinitions().get(name) != null) { handleDataType(name, attrs); + } else if (helperImpl.project.getTaskDefinitions().get(name) != null) { + handleTask(name, attrs); } else { throw new SAXParseException("Unexpected element \"" + name + "\"", helperImpl.locator); } } /** - * Handles a task defintion element by creating a task handler - * and initialising is with the details of the element. + * Handles a task by creating a task handler and initialising + * is with the details of the element. * * @param name The name of the element to be handled. * Will not be null. @@ -530,39 +526,7 @@ public class ProjectHelperImpl extends ProjectHelper { * the task handler * */ - private void handleTaskdef(String name, AttributeList attrs) throws SAXParseException { - (new TaskHandler(helperImpl, this, null, null, null)).init(name, attrs); - } - - /** - * Handles a type defintion element by creating a task handler - * and initialising is with the details of the element. - * - * @param name The name of the element to be handled. - * Will not be null. - * @param attrs Attributes of the element to be handled. - * Will not be null. - * - * @exception SAXParseException if an error occurs initialising the - * handler - */ - private void handleTypedef(String name, AttributeList attrs) throws SAXParseException { - (new TaskHandler(helperImpl, this, null, null, null)).init(name, attrs); - } - - /** - * Handles a property defintion element by creating a task handler - * and initialising is with the details of the element. - * - * @param name The name of the element to be handled. - * Will not be null. - * @param attrs Attributes of the element to be handled. - * Will not be null. - * - * @exception SAXParseException if an error occurs initialising - * the handler - */ - private void handleProperty(String name, AttributeList attrs) throws SAXParseException { + private void handleTask(String name, AttributeList attrs) throws SAXParseException { (new TaskHandler(helperImpl, this, null, null, null)).init(name, attrs); }