git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272661 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -173,17 +173,13 @@ public class ProjectHandler extends ModelElementHandler { | |||||
| } catch (ModelException e) { | } catch (ModelException e) { | ||||
| throw new SAXParseException(e.getMessage(), getLocator(), e); | throw new SAXParseException(e.getMessage(), getLocator(), e); | ||||
| } | } | ||||
| } else if (localName != null) { | |||||
| } else { | |||||
| // everything else is a task | // everything else is a task | ||||
| BuildElementHandler buildElementHandler = new BuildElementHandler(); | BuildElementHandler buildElementHandler = new BuildElementHandler(); | ||||
| buildElementHandler.start(getParseContext(), getXMLReader(), | buildElementHandler.start(getParseContext(), getXMLReader(), | ||||
| this, getLocator(), attributes, getElementSource(), | this, getLocator(), attributes, getElementSource(), | ||||
| qualifiedName); | qualifiedName); | ||||
| project.addTask(buildElementHandler.getBuildElement()); | project.addTask(buildElementHandler.getBuildElement()); | ||||
| } else { | |||||
| // ignore namespaced elements | |||||
| throw new SAXParseException("namespace support is not " | |||||
| + "currently recognized (" + qualifiedName + ")", getLocator()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -116,11 +116,12 @@ public class InitConfig { | |||||
| /** | /** | ||||
| * Constructor for the Initialization configuration | * Constructor for the Initialization configuration | ||||
| * | * | ||||
| * @param libraryClass - a class loaded from the Ant library area. | |||||
| * @exception InitException if the configuration cannot be initialized | * @exception InitException if the configuration cannot be initialized | ||||
| */ | */ | ||||
| public InitConfig() throws InitException { | |||||
| public InitConfig(Class libraryClass) throws InitException { | |||||
| try { | try { | ||||
| URL antLibURL = getAntLibURL(); | |||||
| URL antLibURL = getAntLibURL(libraryClass); | |||||
| setLibraryURL(antLibURL); | setLibraryURL(antLibURL); | ||||
| URL antHome = new URL(antLibURL, ".."); | URL antHome = new URL(antLibURL, ".."); | ||||
| @@ -331,12 +332,13 @@ public class InitConfig { | |||||
| /** | /** | ||||
| * Get a URL to the Ant Library directory. | * Get a URL to the Ant Library directory. | ||||
| * | * | ||||
| * @param libraryClass - a class loaded from the Ant library area. | |||||
| * @return the URL for the Ant library directory | * @return the URL for the Ant library directory | ||||
| * @throws MalformedURLException if there is a problem constructing the | * @throws MalformedURLException if there is a problem constructing the | ||||
| * library URL | * library URL | ||||
| */ | */ | ||||
| private URL getAntLibURL() throws MalformedURLException { | |||||
| URL initClassURL = ClassLocator.getClassLocationURL(getClass()); | |||||
| private URL getAntLibURL(Class libraryClass) throws MalformedURLException { | |||||
| URL initClassURL = ClassLocator.getClassLocationURL(libraryClass); | |||||
| String initURLString = initClassURL.toString(); | String initURLString = initClassURL.toString(); | ||||
| int index = initURLString.lastIndexOf("/"); | int index = initURLString.lastIndexOf("/"); | ||||
| @@ -135,7 +135,7 @@ public class Main { | |||||
| public void start(String frontend, String defaultClass, String[] args) | public void start(String frontend, String defaultClass, String[] args) | ||||
| throws InitException { | throws InitException { | ||||
| try { | try { | ||||
| InitConfig config = new InitConfig(); | |||||
| InitConfig config = new InitConfig(getClass()); | |||||
| URL frontendJar = new URL(config.getLibraryURL(), | URL frontendJar = new URL(config.getLibraryURL(), | ||||
| "frontend/" + frontend + ".jar"); | "frontend/" + frontend + ".jar"); | ||||
| @@ -149,8 +149,8 @@ public class Main { | |||||
| if (frontendJar.getProtocol().equals("file")) { | if (frontendJar.getProtocol().equals("file")) { | ||||
| File jarFile = new File(frontendJar.getFile()); | File jarFile = new File(frontendJar.getFile()); | ||||
| if (!jarFile.exists()) { | if (!jarFile.exists()) { | ||||
| throw new InitException("Could not jar for frontend \"" | |||||
| + frontend + "\""); | |||||
| throw new InitException("Could not find jar for frontend \"" | |||||
| + frontend + "\" - expected at " + frontendJar); | |||||
| } | } | ||||
| } | } | ||||
| String mainClass = getMainClass(frontendJar); | String mainClass = getMainClass(frontendJar); | ||||