git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273311 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -55,6 +55,7 @@ | |||||
| package org.apache.tools.ant; | package org.apache.tools.ant; | ||||
| import java.io.Serializable; | import java.io.Serializable; | ||||
| import org.xml.sax.Locator; | |||||
| /** | /** | ||||
| * Stores the location of a piece of text within a file (file name, | * Stores the location of a piece of text within a file (file name, | ||||
| @@ -92,6 +93,18 @@ public class Location implements Serializable { | |||||
| this(fileName, 0, 0); | this(fileName, 0, 0); | ||||
| } | } | ||||
| /** | |||||
| * Creates a location from the SAX locator using the system ID as | |||||
| * the filename. | |||||
| * | |||||
| * @param locator Must not be <code>null</code>. | |||||
| * | |||||
| * @since Ant 1.6 | |||||
| */ | |||||
| public Location(Locator loc) { | |||||
| this(loc.getSystemId(), loc.getLineNumber(), loc.getColumnNumber()); | |||||
| } | |||||
| /** | /** | ||||
| * Creates a location consisting of a file name, line number and | * Creates a location consisting of a file name, line number and | ||||
| * column number. | * column number. | ||||
| @@ -578,7 +578,8 @@ public class ProjectHelperImpl extends ProjectHelper { | |||||
| name = value; | name = value; | ||||
| if (name.equals("")) { | if (name.equals("")) { | ||||
| throw new BuildException("name attribute must not" | throw new BuildException("name attribute must not" | ||||
| + " be empty"); | |||||
| + " be empty", | |||||
| new Location(helperImpl.locator)); | |||||
| } | } | ||||
| } else if (key.equals("depends")) { | } else if (key.equals("depends")) { | ||||
| depends = value; | depends = value; | ||||
| @@ -783,8 +784,7 @@ public class ProjectHelperImpl extends ProjectHelper { | |||||
| task.setTaskName(tag); | task.setTaskName(tag); | ||||
| } | } | ||||
| task.setLocation(new Location(helperImpl.locator.getSystemId(), helperImpl.locator.getLineNumber(), | |||||
| helperImpl.locator.getColumnNumber())); | |||||
| task.setLocation(new Location(helperImpl.locator)); | |||||
| helperImpl.configureId(task, attrs); | helperImpl.configureId(task, attrs); | ||||
| task.setOwningTarget(target); | task.setOwningTarget(target); | ||||