You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2002/09/09 12:34:48 UTC
cvs commit: jakarta-ant/src/main/org/apache/tools/ant/helper ProjectHelperImpl.java
bodewig 2002/09/09 03:34:48
Modified: src/main/org/apache/tools/ant Location.java
src/main/org/apache/tools/ant/helper ProjectHelperImpl.java
Log:
Supply location when complaining about empty target names.
Revision Changes Path
1.9 +13 -0 jakarta-ant/src/main/org/apache/tools/ant/Location.java
Index: Location.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Location.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Location.java 15 Jul 2002 12:37:56 -0000 1.8
+++ Location.java 9 Sep 2002 10:34:48 -0000 1.9
@@ -55,6 +55,7 @@
package org.apache.tools.ant;
import java.io.Serializable;
+import org.xml.sax.Locator;
/**
* Stores the location of a piece of text within a file (file name,
@@ -90,6 +91,18 @@
*/
public Location(String fileName) {
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());
}
/**
1.15 +3 -3 jakarta-ant/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java
Index: ProjectHelperImpl.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- ProjectHelperImpl.java 25 Jul 2002 15:21:03 -0000 1.14
+++ ProjectHelperImpl.java 9 Sep 2002 10:34:48 -0000 1.15
@@ -578,7 +578,8 @@
name = value;
if (name.equals("")) {
throw new BuildException("name attribute must not"
- + " be empty");
+ + " be empty",
+ new Location(helperImpl.locator));
}
} else if (key.equals("depends")) {
depends = value;
@@ -783,8 +784,7 @@
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);
task.setOwningTarget(target);
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>