diff options
author | Peter Donald <donaldp@apache.org> | 2002-07-23 08:39:59 +0000 |
---|---|---|
committer | Peter Donald <donaldp@apache.org> | 2002-07-23 08:39:59 +0000 |
commit | f9121ee81e58e6cb4369a4e043e0a88cbfe3e503 (patch) | |
tree | 91897e158e77b975b1e11ecc2f2a6825b81c71b9 /src/main | |
parent | 12e8a63e2f797fdfb28e9f30761669465cb033ee (diff) | |
download | ant-f9121ee81e58e6cb4369a4e043e0a88cbfe3e503.tar.gz |
Encapsulate some fields in Task and add some deprecation warnings to coresponding fields.
git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273157 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/main')
95 files changed, 362 insertions, 325 deletions
diff --git a/src/main/org/apache/tools/ant/Task.java b/src/main/org/apache/tools/ant/Task.java index fc3a17a18..d5e6d07cb 100644 --- a/src/main/org/apache/tools/ant/Task.java +++ b/src/main/org/apache/tools/ant/Task.java @@ -65,12 +65,26 @@ import java.util.Enumeration; * @see Project#createTask */ public abstract class Task extends ProjectComponent { - /** Target this task belongs to, if any. */ + /** + * Target this task belongs to, if any. + * @deprecated You should not be accessing this variable directly. + * Please use the {@link #getOwningTarget()} method. + */ protected Target target; - /** Description of this task, if any. */ + + /** + * Description of this task, if any. + * @deprecated You should not be accessing this variable directly. + */ protected String description; - /** Location within the build file of this task definition. */ + + /** + * Location within the build file of this task definition. + * @deprecated You should not be accessing this variable directly. + * Please use the {@link #getLocation()} method. + */ protected Location location = Location.UNKNOWN_LOCATION; + /** * Name of this task to be used for logging purposes. * This defaults to the same as the type, but may be @@ -78,18 +92,33 @@ public abstract class Task extends ProjectComponent { * isn't terribly descriptive for a task used within * another task - the outer task code can probably * provide a better one. + * @deprecated You should not be accessing this variable directly. + * Please use the {@link #getTaskName()} method. + */ + protected String taskName; + + /** + * Type of this task. + * + * @deprecated You should not be accessing this variable directly. + * Please use the {@link #getTaskType()} method. + */ + protected String taskType; + + /** + * Wrapper for this object, used to configure it at runtime. + * + * @deprecated You should not be accessing this variable directly. + * Please use the {@link #getWrapper()} method. */ - protected String taskName = null; - /** Type of this task. */ - protected String taskType = null; - /** Wrapper for this object, used to configure it at runtime. */ protected RuntimeConfigurable wrapper; + /** * Whether or not this task is invalid. A task becomes invalid * if a conflicting class is specified as the implementation for * its type. */ - private boolean invalid = false; + private boolean invalid; /** Sole constructor. */ public Task() { @@ -401,4 +430,12 @@ public abstract class Task extends ProjectComponent { replaceChildren(childWrapper, childElement); } } + + protected String getTaskType() { + return taskType; + } + + protected RuntimeConfigurable getWrapper() { + return wrapper; + } } diff --git a/src/main/org/apache/tools/ant/UnknownElement.java b/src/main/org/apache/tools/ant/UnknownElement.java index 80e98acd9..35fcf683d 100644 --- a/src/main/org/apache/tools/ant/UnknownElement.java +++ b/src/main/org/apache/tools/ant/UnknownElement.java @@ -112,16 +112,16 @@ public class UnknownElement extends Task { * @exception BuildException if the configuration fails */ public void maybeConfigure() throws BuildException { - realThing = makeObject(this, wrapper); + realThing = makeObject(this, getWrapper()); - wrapper.setProxy(realThing); + getWrapper().setProxy(realThing); if (realThing instanceof Task) { - ((Task) realThing).setRuntimeConfigurableWrapper(wrapper); + ((Task) realThing).setRuntimeConfigurableWrapper(getWrapper()); } - handleChildren(realThing, wrapper); + handleChildren(realThing, getWrapper()); - wrapper.maybeConfigure(getProject()); + getWrapper().maybeConfigure(getProject()); } /** @@ -159,7 +159,7 @@ public class UnknownElement extends Task { // plain impossible to get here, maybeConfigure should // have thrown an exception. throw new BuildException("Could not create task of type: " - + elementName, location); + + elementName, getLocation()); } if (realThing instanceof Task) { @@ -271,7 +271,7 @@ public class UnknownElement extends Task { if (task != null) { task.setLocation(getLocation()); // UnknownElement always has an associated target - task.setOwningTarget(target); + task.setOwningTarget(getOwningTarget()); task.init(); } return task; @@ -325,7 +325,7 @@ public class UnknownElement extends Task { + "as this is not an Ant bug."; - return new BuildException(msg, location); + return new BuildException(msg, getLocation()); } /** diff --git a/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java b/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java index 652d42c1c..530b3ddca 100644 --- a/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java @@ -214,7 +214,7 @@ public abstract class AbstractCvsTask extends Task { .getPath(), append)))); } catch (IOException e) { - throw new BuildException(e, location); + throw new BuildException(e, getLocation()); } } else { setOutputStream(new LogOutputStream(this, Project.MSG_INFO)); @@ -241,7 +241,7 @@ public abstract class AbstractCvsTask extends Task { new FileOutputStream(error.getPath(), append)))); } catch (IOException e) { - throw new BuildException(e, location); + throw new BuildException(e, getLocation()); } } else { setErrorStream(new LogOutputStream(this, Project.MSG_WARN)); @@ -333,11 +333,11 @@ public abstract class AbstractCvsTask extends Task { + retCode + StringUtils.LINE_SEP + "Command line was [" - + actualCommandLine + "]", location); + + actualCommandLine + "]", getLocation()); } } catch (IOException e) { if (failOnError) { - throw new BuildException(e, location); + throw new BuildException(e, getLocation()); } else { log("Caught exception: " + e.getMessage(), Project.MSG_WARN); } @@ -353,7 +353,7 @@ public abstract class AbstractCvsTask extends Task { } } catch (Exception e) { if (failOnError) { - throw new BuildException(e, location); + throw new BuildException(e, getLocation()); } else { log("Caught exception: " + e.getMessage(), Project.MSG_WARN); } diff --git a/src/main/org/apache/tools/ant/taskdefs/Ant.java b/src/main/org/apache/tools/ant/taskdefs/Ant.java index da519ec6d..e3cccdd02 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Ant.java +++ b/src/main/org/apache/tools/ant/taskdefs/Ant.java @@ -488,7 +488,7 @@ public class Ant extends Task { } catch (Exception e2) { String msg = "Error setting new project instance for " + "reference with id " + oldKey; - throw new BuildException(msg, e2, location); + throw new BuildException(msg, e2, getLocation()); } } newProject.addReference(newKey, copy); diff --git a/src/main/org/apache/tools/ant/taskdefs/AntStructure.java b/src/main/org/apache/tools/ant/taskdefs/AntStructure.java index 5e08f9130..80a120ef9 100644 --- a/src/main/org/apache/tools/ant/taskdefs/AntStructure.java +++ b/src/main/org/apache/tools/ant/taskdefs/AntStructure.java @@ -110,7 +110,7 @@ public class AntStructure extends Task { public void execute() throws BuildException { if (output == null) { - throw new BuildException("output attribute is required", location); + throw new BuildException("output attribute is required", getLocation()); } PrintWriter out = null; @@ -147,8 +147,8 @@ public class AntStructure extends Task { } } catch (IOException ioe) { - throw new BuildException("Error writing " - + output.getAbsolutePath(), ioe, location); + throw new BuildException("Error writing " + + output.getAbsolutePath(), ioe, getLocation()); } finally { if (out != null) { out.close(); @@ -349,8 +349,8 @@ public class AntStructure extends Task { final int count = v.size(); for (int i = 0; i < count; i++) { String nestedName = (String) v.elementAt(i); - if (!"#PCDATA".equals(nestedName) - && !TASKS.equals(nestedName) + if (!"#PCDATA".equals(nestedName) + && !TASKS.equals(nestedName) && !TYPES.equals(nestedName)) { printElementDecl(out, nestedName, ih.getElementType(nestedName)); } diff --git a/src/main/org/apache/tools/ant/taskdefs/Available.java b/src/main/org/apache/tools/ant/taskdefs/Available.java index 557fc3324..bec39f1ab 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Available.java +++ b/src/main/org/apache/tools/ant/taskdefs/Available.java @@ -240,7 +240,7 @@ public class Available extends Task implements Condition { public void execute() throws BuildException { if (property == null) { throw new BuildException("property attribute is required", - location); + getLocation()); } isTask = true; @@ -269,14 +269,14 @@ public class Available extends Task implements Condition { public boolean eval() throws BuildException { if (classname == null && file == null && resource == null) { throw new BuildException("At least one of (classname|file|" - + "resource) is required", location); + + "resource) is required", getLocation()); } if (type != null) { if (file == null) { throw new BuildException("The type attribute is only valid " + "when specifying the file " - + "attribute.", location); + + "attribute.", getLocation()); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java b/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java index 47074840e..189efadcc 100644 --- a/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java +++ b/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java @@ -97,11 +97,11 @@ public class BUnzip2 extends Unpack { bis = new BufferedInputStream(fis); int b = bis.read(); if (b != 'B') { - throw new BuildException("Invalid bz2 file.", location); + throw new BuildException("Invalid bz2 file.", getLocation()); } b = bis.read(); if (b != 'Z') { - throw new BuildException("Invalid bz2 file.", location); + throw new BuildException("Invalid bz2 file.", getLocation()); } zIn = new CBZip2InputStream(bis); byte[] buffer = new byte[8 * 1024]; @@ -112,7 +112,7 @@ public class BUnzip2 extends Unpack { } while (count != -1); } catch (IOException ioe) { String msg = "Problem expanding bzip2 " + ioe.getMessage(); - throw new BuildException(msg, ioe, location); + throw new BuildException(msg, ioe, getLocation()); } finally { if (bis != null) { try { diff --git a/src/main/org/apache/tools/ant/taskdefs/BZip2.java b/src/main/org/apache/tools/ant/taskdefs/BZip2.java index 9047d06b2..167a32f86 100644 --- a/src/main/org/apache/tools/ant/taskdefs/BZip2.java +++ b/src/main/org/apache/tools/ant/taskdefs/BZip2.java @@ -84,7 +84,7 @@ public class BZip2 extends Pack { zipFile(source, zOut); } catch (IOException ioe) { String msg = "Problem creating bzip2 " + ioe.getMessage(); - throw new BuildException(msg, ioe, location); + throw new BuildException(msg, ioe, getLocation()); } finally { if (zOut != null) { try { diff --git a/src/main/org/apache/tools/ant/taskdefs/Basename.java b/src/main/org/apache/tools/ant/taskdefs/Basename.java index 9fff23629..7efbfab52 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Basename.java +++ b/src/main/org/apache/tools/ant/taskdefs/Basename.java @@ -119,10 +119,10 @@ public class Basename extends Task { // The method executing the task public void execute() throws BuildException { if (property == null) { - throw new BuildException("property attribute required", location); + throw new BuildException("property attribute required", getLocation()); } if (file == null) { - throw new BuildException("file attribute required", location); + throw new BuildException("file attribute required", getLocation()); } String value = file.getName(); if (suffix != null && value.endsWith(suffix)) { diff --git a/src/main/org/apache/tools/ant/taskdefs/CallTarget.java b/src/main/org/apache/tools/ant/taskdefs/CallTarget.java index c6337898b..8c294991b 100644 --- a/src/main/org/apache/tools/ant/taskdefs/CallTarget.java +++ b/src/main/org/apache/tools/ant/taskdefs/CallTarget.java @@ -133,7 +133,7 @@ public class CallTarget extends Task { if (subTarget == null) { throw new BuildException("Attribute target is required.", - location); + getLocation()); } callee.setAntfile(getProject().getProperty("ant.file")); diff --git a/src/main/org/apache/tools/ant/taskdefs/Checksum.java b/src/main/org/apache/tools/ant/taskdefs/Checksum.java index 3caf78eb9..755627f78 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Checksum.java +++ b/src/main/org/apache/tools/ant/taskdefs/Checksum.java @@ -284,21 +284,21 @@ public class Checksum extends MatchingTask implements Condition { try { messageDigest = MessageDigest.getInstance(algorithm, provider); } catch (NoSuchAlgorithmException noalgo) { - throw new BuildException(noalgo, location); + throw new BuildException(noalgo, getLocation()); } catch (NoSuchProviderException noprovider) { - throw new BuildException(noprovider, location); + throw new BuildException(noprovider, getLocation()); } } else { try { messageDigest = MessageDigest.getInstance(algorithm); } catch (NoSuchAlgorithmException noalgo) { - throw new BuildException(noalgo, location); + throw new BuildException(noalgo, getLocation()); } } if (messageDigest == null) { throw new BuildException("Unable to create Message Digest", - location); + getLocation()); } if (fileext == null) { @@ -354,7 +354,7 @@ public class Checksum extends MatchingTask implements Condition { + file.getAbsolutePath() + " to generate checksum for."; log(message); - throw new BuildException(message, location); + throw new BuildException(message, getLocation()); } } } @@ -429,7 +429,7 @@ public class Checksum extends MatchingTask implements Condition { } } } catch (Exception e) { - throw new BuildException(e, location); + throw new BuildException(e, getLocation()); } finally { if (fis != null) { try { diff --git a/src/main/org/apache/tools/ant/taskdefs/Chmod.java b/src/main/org/apache/tools/ant/taskdefs/Chmod.java index 96a3b2036..870a3de84 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Chmod.java +++ b/src/main/org/apache/tools/ant/taskdefs/Chmod.java @@ -190,7 +190,7 @@ public class Chmod extends ExecuteOn { protected void checkConfiguration() { if (!havePerm) { throw new BuildException("Required attribute perm not set in chmod", - location); + getLocation()); } if (defaultSetDefined && defaultSet.getDir(getProject()) != null) { @@ -224,7 +224,7 @@ public class Chmod extends ExecuteOn { execute.setCommandline(cloned.getCommandline()); runExecute(execute); } catch (IOException e) { - throw new BuildException("Execute failed: " + e, e, location); + throw new BuildException("Execute failed: " + e, e, getLocation()); } finally { // close the output file if required logFlush(); @@ -236,24 +236,24 @@ public class Chmod extends ExecuteOn { * @ant.attribute ignore="true" */ public void setExecutable(String e) { - throw new BuildException(taskType - + " doesn\'t support the executable attribute", location); + throw new BuildException(getTaskType() + + " doesn\'t support the executable attribute", getLocation()); } /** * @ant.attribute ignore="true" */ public void setCommand(Commandline cmdl) { - throw new BuildException(taskType - + " doesn\'t support the command attribute", location); + throw new BuildException(getTaskType() + + " doesn\'t support the command attribute", getLocation()); } /** * @ant.attribute ignore="true" */ public void setSkipEmptyFilesets(boolean skip) { - throw new BuildException(taskType - + " doesn\'t support the skipemptyfileset attribute", location); + throw new BuildException(getTaskType() + + " doesn\'t support the skipemptyfileset attribute", getLocation()); } protected boolean isValidOs() { diff --git a/src/main/org/apache/tools/ant/taskdefs/Copy.java b/src/main/org/apache/tools/ant/taskdefs/Copy.java index 4611893ee..ea7225142 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Copy.java +++ b/src/main/org/apache/tools/ant/taskdefs/Copy.java @@ -280,7 +280,7 @@ public class Copy extends Task { public Mapper createMapper() throws BuildException { if (mapperElement != null) { throw new BuildException("Cannot define more than one mapper", - location); + getLocation()); } mapperElement = new Mapper(getProject()); return mapperElement; @@ -531,7 +531,7 @@ public class Copy extends Task { } catch (IOException ioe) { String msg = "Failed to copy " + fromFile + " to " + toFile + " due to " + ioe.getMessage(); - throw new BuildException(msg, ioe, location); + throw new BuildException(msg, ioe, getLocation()); } } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Copydir.java b/src/main/org/apache/tools/ant/taskdefs/Copydir.java index 2008396c2..dbfe410f6 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Copydir.java +++ b/src/main/org/apache/tools/ant/taskdefs/Copydir.java @@ -106,17 +106,17 @@ public class Copydir extends MatchingTask { if (srcDir == null) { throw new BuildException("src attribute must be set!", - location); + getLocation()); } if (!srcDir.exists()) { throw new BuildException("srcdir " + srcDir.toString() - + " does not exist!", location); + + " does not exist!", getLocation()); } if (destDir == null) { throw new BuildException("The dest attribute must be set.", - location); + getLocation()); } if (srcDir.equals(destDir)) { @@ -142,7 +142,7 @@ public class Copydir extends MatchingTask { } catch (IOException ioe) { String msg = "Failed to copy " + fromFile + " to " + toFile + " due to " + ioe.getMessage(); - throw new BuildException(msg, ioe, location); + throw new BuildException(msg, ioe, getLocation()); } } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Copyfile.java b/src/main/org/apache/tools/ant/taskdefs/Copyfile.java index a4d5c5b13..39aa53791 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Copyfile.java +++ b/src/main/org/apache/tools/ant/taskdefs/Copyfile.java @@ -100,17 +100,17 @@ public class Copyfile extends Task { if (srcFile == null) { throw new BuildException("The src attribute must be present.", - location); + getLocation()); } if (!srcFile.exists()) { throw new BuildException("src " + srcFile.toString() - + " does not exist.", location); + + " does not exist.", getLocation()); } if (destFile == null) { throw new BuildException("The dest attribute must be present.", - location); + getLocation()); } if (srcFile.equals(destFile)) { diff --git a/src/main/org/apache/tools/ant/taskdefs/Definer.java b/src/main/org/apache/tools/ant/taskdefs/Definer.java index c406c6fbe..3b13aa4ba 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Definer.java +++ b/src/main/org/apache/tools/ant/taskdefs/Definer.java @@ -168,13 +168,13 @@ public abstract class Definer extends Task { if (name != null || value != null) { String msg = "You must not specify name or value " + "together with file or resource."; - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } if (file != null && resource != null) { String msg = "You must not specify both, file and " + "resource."; - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } @@ -209,7 +209,7 @@ public abstract class Definer extends Task { } } } catch (IOException ex) { - throw new BuildException(ex, location); + throw new BuildException(ex, getLocation()); } finally { if (is != null) { try { @@ -233,11 +233,11 @@ public abstract class Definer extends Task { } catch (ClassNotFoundException cnfe) { String msg = getTaskName() + " class " + value + " cannot be found"; - throw new BuildException(msg, cnfe, location); + throw new BuildException(msg, cnfe, getLocation()); } catch (NoClassDefFoundError ncdfe) { String msg = getTaskName() + " class " + value + " cannot be found"; - throw new BuildException(msg, ncdfe, location); + throw new BuildException(msg, ncdfe, getLocation()); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Delete.java b/src/main/org/apache/tools/ant/taskdefs/Delete.java index c147b463c..c11490ef9 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Delete.java +++ b/src/main/org/apache/tools/ant/taskdefs/Delete.java @@ -279,7 +279,7 @@ public class Delete extends MatchingTask { if (quiet && failonerror) { throw new BuildException("quiet and failonerror cannot both be " - + "set to true", location); + + "set to true", getLocation()); } diff --git a/src/main/org/apache/tools/ant/taskdefs/Deltree.java b/src/main/org/apache/tools/ant/taskdefs/Deltree.java index 34f503512..c0efe6a9b 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Deltree.java +++ b/src/main/org/apache/tools/ant/taskdefs/Deltree.java @@ -94,7 +94,7 @@ public class Deltree extends Task { + "Use delete instead."); if (dir == null) { - throw new BuildException("dir attribute must be set!", location); + throw new BuildException("dir attribute must be set!", getLocation()); } if (dir.exists()) { @@ -102,7 +102,7 @@ public class Deltree extends Task { if (!dir.delete()) { throw new BuildException("Unable to delete directory " + dir.getAbsolutePath(), - location); + getLocation()); } return; } @@ -113,7 +113,7 @@ public class Deltree extends Task { removeDir(dir); } catch (IOException ioe) { String msg = "Unable to delete " + dir.getAbsolutePath(); - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Dirname.java b/src/main/org/apache/tools/ant/taskdefs/Dirname.java index 54f37c9f9..2e176d7f3 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Dirname.java +++ b/src/main/org/apache/tools/ant/taskdefs/Dirname.java @@ -107,10 +107,10 @@ public class Dirname extends Task { // The method executing the task public void execute() throws BuildException { if (property == null) { - throw new BuildException("property attribute required", location); + throw new BuildException("property attribute required", getLocation()); } if (file == null) { - throw new BuildException("file attribute required", location); + throw new BuildException("file attribute required", getLocation()); } else { String value = file.getParent(); getProject().setNewProperty(property, value); diff --git a/src/main/org/apache/tools/ant/taskdefs/Ear.java b/src/main/org/apache/tools/ant/taskdefs/Ear.java index 63c48c541..543a4b61c 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Ear.java +++ b/src/main/org/apache/tools/ant/taskdefs/Ear.java @@ -129,7 +129,7 @@ public class Ear extends Jar { throws IOException, BuildException { // If no webxml file is specified, it's an error. if (deploymentDescriptor == null && !isInUpdateMode()) { - throw new BuildException("appxml attribute is required", location); + throw new BuildException("appxml attribute is required", getLocation()); } super.initZipOutputStream(zOut); diff --git a/src/main/org/apache/tools/ant/taskdefs/Echo.java b/src/main/org/apache/tools/ant/taskdefs/Echo.java index 0092b5a23..a51eea773 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Echo.java +++ b/src/main/org/apache/tools/ant/taskdefs/Echo.java @@ -93,7 +93,7 @@ public class Echo extends Task { out = new FileWriter(file.getAbsolutePath(), append); out.write(message, 0, message.length()); } catch (IOException ioe) { - throw new BuildException(ioe, location); + throw new BuildException(ioe, getLocation()); } finally { if (out != null) { try { diff --git a/src/main/org/apache/tools/ant/taskdefs/Exec.java b/src/main/org/apache/tools/ant/taskdefs/Exec.java index fdda6bdfa..8c6dc59de 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Exec.java +++ b/src/main/org/apache/tools/ant/taskdefs/Exec.java @@ -125,7 +125,7 @@ public class Exec extends Task { String ant = getProject().getProperty("ant.home"); if (ant == null) { throw new BuildException("Property 'ant.home' not " - + "found", location); + + "found", getLocation()); } String antRun = getProject().resolveFile(ant + "/bin/antRun.bat").toString(); @@ -135,8 +135,8 @@ public class Exec extends Task { } else { String ant = getProject().getProperty("ant.home"); if (ant == null) { - throw new BuildException("Property 'ant.home' not found", - location); + throw new BuildException("Property 'ant.home' not found", + getLocation()); } String antRun = getProject().resolveFile(ant + "/bin/antRun").toString(); @@ -178,13 +178,13 @@ public class Exec extends Task { err = proc.exitValue(); if (err != 0) { if (failOnError) { - throw new BuildException("Exec returned: " + err, location); + throw new BuildException("Exec returned: " + err, getLocation()); } else { log("Result: " + err, Project.MSG_ERR); } } } catch (IOException ioe) { - throw new BuildException("Error exec: " + command, ioe, location); + throw new BuildException("Error exec: " + command, ioe, getLocation()); } catch (InterruptedException ex) {} return err; diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecTask.java b/src/main/org/apache/tools/ant/taskdefs/ExecTask.java index da8c8b2b6..0cbe97056 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ExecTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/ExecTask.java @@ -259,7 +259,7 @@ public class ExecTask extends Task { */ protected void checkConfiguration() throws BuildException { if (cmdl.getExecutable() == null) { - throw new BuildException("no executable specified", location); + throw new BuildException("no executable specified", getLocation()); } if (dir != null && !dir.exists()) { throw new BuildException("The directory you specified does not " @@ -334,8 +334,8 @@ public class ExecTask extends Task { maybeSetResultPropertyValue(err); if (err != 0) { if (failOnError) { - throw new BuildException(taskType + " returned: " + err, - location); + throw new BuildException(getTaskType() + " returned: " + err, + getLocation()); } else { log("Result: " + err, Project.MSG_ERR); } @@ -369,7 +369,7 @@ public class ExecTask extends Task { } catch (IOException e) { if (failIfExecFails) { throw new BuildException("Execute failed: " + e.toString(), e, - location); + getLocation()); } else { log("Execute failed: " + e.toString(), Project.MSG_ERR); } @@ -390,10 +390,10 @@ public class ExecTask extends Task { return new PumpStreamHandler(fos); } catch (FileNotFoundException fne) { throw new BuildException("Cannot write to " + out, fne, - location); + getLocation()); } catch (IOException ioe) { throw new BuildException("Cannot write to " + out, ioe, - location); + getLocation()); } } else if (outputprop != null) { baos = new ByteArrayOutputStream(); diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java b/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java index c360ee5a3..d26a92270 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java +++ b/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java @@ -151,8 +151,8 @@ public class ExecuteOn extends ExecTask { */ public Commandline.Marker createSrcfile() { if (srcFilePos != null) { - throw new BuildException(taskType + " doesn\'t support multiple " - + "srcfile elements.", location); + throw new BuildException(getTaskType() + " doesn\'t support multiple " + + "srcfile elements.", getLocation()); } srcFilePos = cmdl.createMarker(); return srcFilePos; @@ -164,8 +164,8 @@ public class ExecuteOn extends ExecTask { */ public Commandline.Marker createTargetfile() { if (targetFilePos != null) { - throw new BuildException(taskType + " doesn\'t support multiple " - + "targetfile elements.", location); + throw new BuildException(getTaskType() + " doesn\'t support multiple " + + "targetfile elements.", getLocation()); } targetFilePos = cmdl.createMarker(); srcIsFirst = (srcFilePos != null); @@ -178,7 +178,7 @@ public class ExecuteOn extends ExecTask { public Mapper createMapper() throws BuildException { if (mapperElement != null) { throw new BuildException("Cannot define more than one mapper", - location); + getLocation()); } mapperElement = new Mapper(getProject()); return mapperElement; @@ -189,24 +189,24 @@ public class ExecuteOn extends ExecTask { * this should probably be modified to use the classname instead. */ protected void checkConfiguration() { - if ("execon".equals(taskName)) { + if ("execon".equals(getTaskName())) { log("!! execon is deprecated. Use apply instead. !!"); } super.checkConfiguration(); if (filesets.size() == 0) { - throw new BuildException("no filesets specified", location); + throw new BuildException("no filesets specified", getLocation()); } if (targetFilePos != null || mapperElement != null || destDir != null) { if (mapperElement == null) { - throw new BuildException("no mapper specified", location); + throw new BuildException("no mapper specified", getLocation()); } if (destDir == null) { throw new BuildException("no dest attribute specified", - location); + getLocation()); } mapper = mapperElement.getImplementation(); } @@ -271,7 +271,7 @@ public class ExecuteOn extends ExecTask { } } catch (IOException e) { - throw new BuildException("Execute failed: " + e, e, location); + throw new BuildException("Execute failed: " + e, e, getLocation()); } finally { // close the output file if required logFlush(); diff --git a/src/main/org/apache/tools/ant/taskdefs/Expand.java b/src/main/org/apache/tools/ant/taskdefs/Expand.java index d133b076a..e1010569e 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Expand.java +++ b/src/main/org/apache/tools/ant/taskdefs/Expand.java @@ -99,7 +99,7 @@ public class Expand extends Task { * @exception BuildException Thrown in unrecoverable error. */ public void execute() throws BuildException { - if ("expand".equals(taskType)) { + if ("expand".equals(getTaskType())) { log("!! expand is deprecated. Use unzip instead. !!"); } @@ -114,7 +114,7 @@ public class Expand extends Task { } if (dest.exists() && !dest.isDirectory()) { - throw new BuildException("Dest must be a directory.", location); + throw new BuildException("Dest must be a directory.", getLocation()); } FileUtils fileUtils = FileUtils.newFileUtils(); @@ -122,7 +122,7 @@ public class Expand extends Task { if (source != null) { if (source.isDirectory()) { throw new BuildException("Src must not be a directory." + - " Use nested filesets instead.", location); + " Use nested filesets instead.", getLocation()); } else { expandFile(fileUtils, source, dest); } diff --git a/src/main/org/apache/tools/ant/taskdefs/Filter.java b/src/main/org/apache/tools/ant/taskdefs/Filter.java index 785289ab0..2cd05a9a9 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Filter.java +++ b/src/main/org/apache/tools/ant/taskdefs/Filter.java @@ -115,7 +115,7 @@ public class Filter extends Task { if (!isFiltersFromFile && !isSingleFilter) { throw new BuildException("both token and value parameters, or " + "only a filtersFile parameter is " - + "required", location); + + "required", getLocation()); } if (isSingleFilter) { diff --git a/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java b/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java index 3599e15d0..832f9c187 100644 --- a/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java +++ b/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java @@ -299,7 +299,7 @@ public class FixCRLF extends MatchingTask { public void setTablength(int tlength) throws BuildException { if (tlength < 2 || tlength > 80) { throw new BuildException("tablength must be between 2 and 80", - location); + getLocation()); } tablength = tlength; StringBuffer sp = new StringBuffer(); diff --git a/src/main/org/apache/tools/ant/taskdefs/GUnzip.java b/src/main/org/apache/tools/ant/taskdefs/GUnzip.java index 1725a07b4..e94bfd18b 100644 --- a/src/main/org/apache/tools/ant/taskdefs/GUnzip.java +++ b/src/main/org/apache/tools/ant/taskdefs/GUnzip.java @@ -102,7 +102,7 @@ public class GUnzip extends Unpack { } while (count != -1); } catch (IOException ioe) { String msg = "Problem expanding gzip " + ioe.getMessage(); - throw new BuildException(msg, ioe, location); + throw new BuildException(msg, ioe, getLocation()); } finally { if (fis != null) { try { diff --git a/src/main/org/apache/tools/ant/taskdefs/GZip.java b/src/main/org/apache/tools/ant/taskdefs/GZip.java index ebadbb47b..6c9c59890 100644 --- a/src/main/org/apache/tools/ant/taskdefs/GZip.java +++ b/src/main/org/apache/tools/ant/taskdefs/GZip.java @@ -81,7 +81,7 @@ public class GZip extends Pack { zipFile(source, zOut); } catch (IOException ioe) { String msg = "Problem creating gzip " + ioe.getMessage(); - throw new BuildException(msg, ioe, location); + throw new BuildException(msg, ioe, getLocation()); } finally { if (zOut != null) { try { diff --git a/src/main/org/apache/tools/ant/taskdefs/Get.java b/src/main/org/apache/tools/ant/taskdefs/Get.java index 5cd37060d..aa751a310 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Get.java +++ b/src/main/org/apache/tools/ant/taskdefs/Get.java @@ -98,21 +98,21 @@ public class Get extends Task { */ public void execute() throws BuildException { if (source == null) { - throw new BuildException("src attribute is required", location); + throw new BuildException("src attribute is required", getLocation()); } if (dest == null) { - throw new BuildException("dest attribute is required", location); + throw new BuildException("dest attribute is required", getLocation()); } if (dest.exists() && dest.isDirectory()) { throw new BuildException("The specified destination is a directory", - location); + getLocation()); } if (dest.exists() && !dest.canWrite()) { throw new BuildException("Can't write to " + dest.getAbsolutePath(), - location); + getLocation()); } try { @@ -209,7 +209,7 @@ public class Get extends Task { return; } throw new BuildException("Can't get " + source + " to " + dest, - location); + getLocation()); } FileOutputStream fos = new FileOutputStream(dest); @@ -263,7 +263,7 @@ public class Get extends Task { if (ignoreErrors) { return; } - throw new BuildException(ioe, location); + throw new BuildException(ioe, getLocation()); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/JDBCTask.java b/src/main/org/apache/tools/ant/taskdefs/JDBCTask.java index e0cdc642c..7919f74f1 100644 --- a/src/main/org/apache/tools/ant/taskdefs/JDBCTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/JDBCTask.java @@ -325,13 +325,13 @@ public abstract class JDBCTask extends Task { */ protected Connection getConnection() throws BuildException { if (userId == null) { - throw new BuildException("User Id attribute must be set!", location); + throw new BuildException("User Id attribute must be set!", getLocation()); } if (password == null) { - throw new BuildException("Password attribute must be set!", location); + throw new BuildException("Password attribute must be set!", getLocation()); } if (url == null) { - throw new BuildException("Url attribute must be set!", location); + throw new BuildException("Url attribute must be set!", getLocation()); } try { @@ -349,7 +349,7 @@ public abstract class JDBCTask extends Task { conn.setAutoCommit(autocommit); return conn; } catch (SQLException e) { - throw new BuildException(e, location); + throw new BuildException(e, getLocation()); } } @@ -362,7 +362,7 @@ public abstract class JDBCTask extends Task { */ private Driver getDriver() throws BuildException { if (driver == null) { - throw new BuildException("Driver attribute must be set!", location); + throw new BuildException("Driver attribute must be set!", getLocation()); } Driver driverInstance = null; @@ -402,15 +402,15 @@ public abstract class JDBCTask extends Task { } catch (ClassNotFoundException e) { throw new BuildException( "Class Not Found: JDBC driver " + driver + " could not be loaded", - location); + getLocation()); } catch (IllegalAccessException e) { throw new BuildException( "Illegal Access: JDBC driver " + driver + " could not be loaded", - location); + getLocation()); } catch (InstantiationException e) { throw new BuildException( "Instantiation Exception: JDBC driver " + driver + " could not be loaded", - location); + getLocation()); } return driverInstance; } diff --git a/src/main/org/apache/tools/ant/taskdefs/Java.java b/src/main/org/apache/tools/ant/taskdefs/Java.java index f7f93278c..e91e5a87b 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Java.java +++ b/src/main/org/apache/tools/ant/taskdefs/Java.java @@ -107,7 +107,7 @@ public class Java extends Task { try { if ((err = executeJava()) != 0) { if (failOnError) { - throw new BuildException("Java returned: " + err, location); + throw new BuildException("Java returned: " + err, getLocation()); } else { log("Java Result: " + err, Project.MSG_ERR); } @@ -405,7 +405,7 @@ public class Java extends Task { append)); exe.execute(getProject()); } catch (IOException io) { - throw new BuildException(io, location); + throw new BuildException(io, getLocation()); } finally { if (outStream != null) { outStream.close(); @@ -440,7 +440,7 @@ public class Java extends Task { } else if (!dir.exists() || !dir.isDirectory()) { throw new BuildException(dir.getAbsolutePath() + " is not a valid directory", - location); + getLocation()); } exe.setWorkingDirectory(dir); @@ -463,10 +463,10 @@ public class Java extends Task { } return rc; } catch (IOException e) { - throw new BuildException(e, location); + throw new BuildException(e, getLocation()); } } catch (IOException io) { - throw new BuildException(io, location); + throw new BuildException(io, getLocation()); } finally { if (fos != null) { try {fos.close();} catch (IOException io) {} diff --git a/src/main/org/apache/tools/ant/taskdefs/Javac.java b/src/main/org/apache/tools/ant/taskdefs/Javac.java index 0c5067a5d..abeb1efde 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Javac.java +++ b/src/main/org/apache/tools/ant/taskdefs/Javac.java @@ -670,7 +670,7 @@ public class Javac extends MatchingTask { if (!srcDir.exists()) { throw new BuildException("srcdir \"" + srcDir.getPath() - + "\" does not exist!", location); + + "\" does not exist!", getLocation()); } DirectoryScanner ds = this.getDirectoryScanner(srcDir); @@ -794,18 +794,18 @@ public class Javac extends MatchingTask { protected void checkParameters() throws BuildException { if (src == null) { throw new BuildException("srcdir attribute must be set!", - location); + getLocation()); } if (src.size() == 0) { throw new BuildException("srcdir attribute must be set!", - location); + getLocation()); } if (destDir != null && !destDir.isDirectory()) { throw new BuildException("destination directory \"" + destDir + "\" does not exist " - + "or is not a directory", location); + + "or is not a directory", getLocation()); } } @@ -839,7 +839,7 @@ public class Javac extends MatchingTask { // finally, lets execute the compiler!! if (!adapter.execute()) { if (failOnError) { - throw new BuildException(FAIL_MSG, location); + throw new BuildException(FAIL_MSG, getLocation()); } else { log(FAIL_MSG, Project.MSG_ERR); } diff --git a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java index b3d3c35c3..57028ba96 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java +++ b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java @@ -1498,7 +1498,7 @@ public class Javadoc extends Task { } public void execute() throws BuildException { - if ("javadoc2".equals(taskType)) { + if ("javadoc2".equals(getTaskType())) { log("!! javadoc2 is deprecated. Use javadoc instead. !!"); } @@ -1598,7 +1598,7 @@ public class Javadoc extends Task { if (doclet != null) { if (doclet.getName() == null) { throw new BuildException("The doclet name must be " - + "specified.", location); + + "specified.", getLocation()); } else { toExecute.createArgument().setValue("-doclet"); toExecute.createArgument().setValue(doclet.getName()); @@ -1806,7 +1806,7 @@ public class Javadoc extends Task { } catch (IOException e) { tmpList.delete(); throw new BuildException("Error creating temporary file", - e, location); + e, getLocation()); } finally { if (srcListWriter != null) { srcListWriter.close(); @@ -1836,10 +1836,10 @@ public class Javadoc extends Task { exe.setCommandline(toExecute.getCommandline()); int ret = exe.execute(); if (ret != 0 && failOnError) { - throw new BuildException("Javadoc returned " + ret, location); + throw new BuildException("Javadoc returned " + ret, getLocation()); } } catch (IOException e) { - throw new BuildException("Javadoc failed: " + e, e, location); + throw new BuildException("Javadoc failed: " + e, e, getLocation()); } finally { if (tmpList != null) { tmpList.delete(); diff --git a/src/main/org/apache/tools/ant/taskdefs/LoadFile.java b/src/main/org/apache/tools/ant/taskdefs/LoadFile.java index c19f30d2e..e8f32bef1 100644 --- a/src/main/org/apache/tools/ant/taskdefs/LoadFile.java +++ b/src/main/org/apache/tools/ant/taskdefs/LoadFile.java @@ -206,7 +206,7 @@ public final class LoadFile extends Task { } catch (final IOException ioe) { final String message = "Unable to load file: " + ioe.toString(); if (failOnError) { - throw new BuildException(message, ioe, location); + throw new BuildException(message, ioe, getLocation()); } else { log(message, Project.MSG_ERR); } diff --git a/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java b/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java index a57ec5109..1da0813cd 100644 --- a/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java +++ b/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java @@ -190,7 +190,7 @@ public final class LoadProperties extends Task { } catch (final IOException ioe) { final String message = "Unable to load file: " + ioe.toString(); - throw new BuildException(message, ioe, location); + throw new BuildException(message, ioe, getLocation()); } catch (final BuildException be) { throw be; } finally { diff --git a/src/main/org/apache/tools/ant/taskdefs/ManifestTask.java b/src/main/org/apache/tools/ant/taskdefs/ManifestTask.java index c94d67c75..e4b6badf6 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ManifestTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/ManifestTask.java @@ -176,10 +176,10 @@ public class ManifestTask extends Task { current = new Manifest(f); } catch (ManifestException m) { error = new BuildException("Existing manifest " + manifestFile - + " is invalid", m, location); + + " is invalid", m, getLocation()); } catch (IOException e) { error = new BuildException("Failed to read " + manifestFile, - e, location); + e, getLocation()); } finally { if (f != null) { try { @@ -200,7 +200,7 @@ public class ManifestTask extends Task { toWrite.merge(nestedManifest); } catch (ManifestException m) { - throw new BuildException("Manifest is invalid", m, location); + throw new BuildException("Manifest is invalid", m, getLocation()); } if (toWrite.equals(current)) { @@ -215,7 +215,7 @@ public class ManifestTask extends Task { toWrite.write(w); } catch (IOException e) { throw new BuildException("Failed to write " + manifestFile, - e, location); + e, getLocation()); } finally { if (w != null) { w.close(); diff --git a/src/main/org/apache/tools/ant/taskdefs/Mkdir.java b/src/main/org/apache/tools/ant/taskdefs/Mkdir.java index 29571fced..7d0f51f88 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Mkdir.java +++ b/src/main/org/apache/tools/ant/taskdefs/Mkdir.java @@ -82,7 +82,7 @@ public class Mkdir extends Task { */ public void execute() throws BuildException { if (dir == null) { - throw new BuildException("dir attribute is required", location); + throw new BuildException("dir attribute is required", getLocation()); } if (dir.isFile()) { @@ -96,7 +96,7 @@ public class Mkdir extends Task { if (!result) { String msg = "Directory " + dir.getAbsolutePath() + " creation was not successful for an unknown reason"; - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } log("Created dir: " + dir.getAbsolutePath()); } diff --git a/src/main/org/apache/tools/ant/taskdefs/Move.java b/src/main/org/apache/tools/ant/taskdefs/Move.java index 7660acca6..6fe0c6f6c 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Move.java +++ b/src/main/org/apache/tools/ant/taskdefs/Move.java @@ -116,7 +116,7 @@ public class Move extends Copy { String msg = "Failed to rename dir " + fromDir + " to " + toDir + " due to " + ioe.getMessage(); - throw new BuildException(msg, ioe, location); + throw new BuildException(msg, ioe, getLocation()); } } } @@ -148,7 +148,7 @@ public class Move extends Copy { String msg = "Failed to rename " + fromFile + " to " + toFile + " due to " + ioe.getMessage(); - throw new BuildException(msg, ioe, location); + throw new BuildException(msg, ioe, getLocation()); } if (!moved) { @@ -185,7 +185,7 @@ public class Move extends Copy { String msg = "Failed to copy " + fromFile + " to " + toFile + " due to " + ioe.getMessage(); - throw new BuildException(msg, ioe, location); + throw new BuildException(msg, ioe, getLocation()); } } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Pack.java b/src/main/org/apache/tools/ant/taskdefs/Pack.java index 39e554a0a..c7c1d313a 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Pack.java +++ b/src/main/org/apache/tools/ant/taskdefs/Pack.java @@ -99,21 +99,21 @@ public abstract class Pack extends Task { */ private void validate() throws BuildException { if (zipFile == null) { - throw new BuildException("zipfile attribute is required", location); + throw new BuildException("zipfile attribute is required", getLocation()); } if (zipFile.isDirectory()) { throw new BuildException("zipfile attribute must not " + - "represent a directory!", location); + "represent a directory!", getLocation()); } if (source == null) { - throw new BuildException("src attribute is required", location); + throw new BuildException("src attribute is required", getLocation()); } if (source.isDirectory()) { throw new BuildException("Src attribute must not " + - "represent a directory!", location); + "represent a directory!", getLocation()); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Patch.java b/src/main/org/apache/tools/ant/taskdefs/Patch.java index b61eadcd5..812608738 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Patch.java +++ b/src/main/org/apache/tools/ant/taskdefs/Patch.java @@ -91,7 +91,7 @@ public class Patch extends Task { public void setPatchfile(File file) { if (!file.exists()) { throw new BuildException("patchfile " + file + " doesn\'t exist", - location); + getLocation()); } cmd.createArgument().setValue("-i"); cmd.createArgument().setFile(file); @@ -125,7 +125,7 @@ public class Patch extends Task { */ public void setStrip(int num) throws BuildException { if (num < 0) { - throw new BuildException("strip has to be >= 0", location); + throw new BuildException("strip has to be >= 0", getLocation()); } cmd.createArgument().setValue("-p" + num); } @@ -166,7 +166,7 @@ public class Patch extends Task { public void execute() throws BuildException { if (!havePatchfile) { throw new BuildException("patchfile argument is required", - location); + getLocation()); } Commandline toExecute = (Commandline) cmd.clone(); toExecute.setExecutable("patch"); @@ -185,10 +185,10 @@ public class Patch extends Task { exe.setWorkingDirectory(directory); } else if (!directory.isDirectory()) { throw new BuildException(directory + " is not a directory.", - location); + getLocation()); } else { throw new BuildException("directory " + directory - + " doesn\'t exist", location); + + " doesn\'t exist", getLocation()); } } else { exe.setWorkingDirectory(getProject().getBaseDir()); @@ -198,7 +198,7 @@ public class Patch extends Task { try { exe.execute(); } catch (IOException e) { - throw new BuildException(e, location); + throw new BuildException(e, getLocation()); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Property.java b/src/main/org/apache/tools/ant/taskdefs/Property.java index f0bab59a2..1e2b4b75d 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Property.java +++ b/src/main/org/apache/tools/ant/taskdefs/Property.java @@ -323,19 +323,19 @@ public class Property extends Task { if (value == null && ref == null) { throw new BuildException("You must specify value, location or " + "refid with the name attribute", - location); + getLocation()); } } else { if (file == null && resource == null && env == null) { throw new BuildException("You must specify file, resource or " + "environment when not using the " - + "name attribute", location); + + "name attribute", getLocation()); } } if (file == null && resource == null && prefix != null) { throw new BuildException("Prefix is only valid when loading from " - + "a file or resource", location); + + "a file or resource", getLocation()); } if ((name != null) && (value != null)) { @@ -392,7 +392,7 @@ public class Property extends Task { Project.MSG_VERBOSE); } } catch (IOException ex) { - throw new BuildException(ex, location); + throw new BuildException(ex, getLocation()); } } @@ -426,7 +426,7 @@ public class Property extends Task { log("Unable to find resource " + name, Project.MSG_WARN); } } catch (IOException ex) { - throw new BuildException(ex, location); + throw new BuildException(ex, getLocation()); } finally { if (is != null) { try { diff --git a/src/main/org/apache/tools/ant/taskdefs/Rename.java b/src/main/org/apache/tools/ant/taskdefs/Rename.java index fedec9e5f..d873ecb72 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Rename.java +++ b/src/main/org/apache/tools/ant/taskdefs/Rename.java @@ -109,11 +109,11 @@ public class Rename extends Task { log("DEPRECATED - The rename task is deprecated. Use move instead."); if (dest == null) { - throw new BuildException("dest attribute is required", location); + throw new BuildException("dest attribute is required", getLocation()); } if (src == null) { - throw new BuildException("src attribute is required", location); + throw new BuildException("src attribute is required", getLocation()); } if (replace && dest.exists()) { diff --git a/src/main/org/apache/tools/ant/taskdefs/Replace.java b/src/main/org/apache/tools/ant/taskdefs/Replace.java index d6a4150dd..cfffe13d2 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Replace.java +++ b/src/main/org/apache/tools/ant/taskdefs/Replace.java @@ -318,21 +318,21 @@ public class Replace extends MatchingTask { if (src == null && dir == null) { String message = "Either the file or the dir attribute " + "must be specified"; - throw new BuildException(message, location); + throw new BuildException(message, getLocation()); } if (propertyFile != null && !propertyFile.exists()) { String message = "Property file " + propertyFile.getPath() + " does not exist."; - throw new BuildException(message, location); + throw new BuildException(message, getLocation()); } if (token == null && replacefilters.size() == 0) { String message = "Either token or a nested replacefilter " + "must be specified"; - throw new BuildException(message, location); + throw new BuildException(message, getLocation()); } if (token != null && "".equals(token.getText())) { String message = "The token attribute must not be an empty string."; - throw new BuildException(message, location); + throw new BuildException(message, getLocation()); } } @@ -387,7 +387,7 @@ public class Replace extends MatchingTask { private void processFile(File src) throws BuildException { if (!src.exists()) { throw new BuildException("Replace: source file " + src.getPath() - + " doesn't exist", location); + + " doesn't exist", getLocation()); } File temp = fileUtils.createTempFile("rep", ".tmp", @@ -474,7 +474,7 @@ public class Replace extends MatchingTask { } catch (IOException ioe) { throw new BuildException("IOException in " + src + " - " + ioe.getClass().getName() + ":" - + ioe.getMessage(), ioe, location); + + ioe.getMessage(), ioe, getLocation()); } finally { if (reader != null) { try { diff --git a/src/main/org/apache/tools/ant/taskdefs/Rmic.java b/src/main/org/apache/tools/ant/taskdefs/Rmic.java index 9afdee696..7b120876f 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Rmic.java +++ b/src/main/org/apache/tools/ant/taskdefs/Rmic.java @@ -477,10 +477,10 @@ public class Rmic extends MatchingTask { */ public void execute() throws BuildException { if (baseDir == null) { - throw new BuildException("base attribute must be set!", location); + throw new BuildException("base attribute must be set!", getLocation()); } if (!baseDir.exists()) { - throw new BuildException("base does not exist!", location); + throw new BuildException("base does not exist!", getLocation()); } if (verify) { @@ -519,7 +519,7 @@ public class Rmic extends MatchingTask { // finally, lets execute the compiler!! if (!adapter.execute()) { - throw new BuildException(FAIL_MSG, location); + throw new BuildException(FAIL_MSG, getLocation()); } } @@ -594,7 +594,7 @@ public class Rmic extends MatchingTask { } catch (IOException ioe) { String msg = "Failed to copy " + oldFile + " to " + newFile + " due to " + ioe.getMessage(); - throw new BuildException(msg, ioe, location); + throw new BuildException(msg, ioe, getLocation()); } } } diff --git a/src/main/org/apache/tools/ant/taskdefs/SQLExec.java b/src/main/org/apache/tools/ant/taskdefs/SQLExec.java index be5d5d45a..17493dedd 100644 --- a/src/main/org/apache/tools/ant/taskdefs/SQLExec.java +++ b/src/main/org/apache/tools/ant/taskdefs/SQLExec.java @@ -327,12 +327,12 @@ public class SQLExec extends JDBCTask { if (transactions.size() == 0) { throw new BuildException("Source file or fileset, " + "transactions or sql statement " - + "must be set!", location); + + "must be set!", getLocation()); } } if (srcFile != null && !srcFile.exists()) { - throw new BuildException("Source file does not exist!", location); + throw new BuildException("Source file does not exist!", getLocation()); } // deal with the filesets @@ -395,14 +395,14 @@ public class SQLExec extends JDBCTask { conn.rollback(); } catch (SQLException ex) {} } - throw new BuildException(e, location); + throw new BuildException(e, getLocation()); } catch (SQLException e){ if (!isAutocommit() && conn != null && onError.equals("abort")) { try { conn.rollback(); } catch (SQLException ex) {} } - throw new BuildException(e, location); + throw new BuildException(e, getLocation()); } finally { try { if (statement != null) { diff --git a/src/main/org/apache/tools/ant/taskdefs/Tar.java b/src/main/org/apache/tools/ant/taskdefs/Tar.java index 6aa84eca9..118852483 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Tar.java +++ b/src/main/org/apache/tools/ant/taskdefs/Tar.java @@ -227,17 +227,17 @@ public class Tar extends MatchingTask { public void execute() throws BuildException { if (tarFile == null) { throw new BuildException("tarfile attribute must be set!", - location); + getLocation()); } if (tarFile.exists() && tarFile.isDirectory()) { throw new BuildException("tarfile is a directory!", - location); + getLocation()); } if (tarFile.exists() && !tarFile.canWrite()) { throw new BuildException("Can not write to the specified tarfile!", - location); + getLocation()); } Vector savedFileSets = (Vector) filesets.clone(); @@ -245,7 +245,7 @@ public class Tar extends MatchingTask { if (baseDir != null) { if (!baseDir.exists()) { throw new BuildException("basedir does not exist!", - location); + getLocation()); } // add the main fileset to the list of filesets to process. @@ -257,7 +257,7 @@ public class Tar extends MatchingTask { if (filesets.size() == 0) { throw new BuildException("You must supply either a basedir " + "attribute or some nested filesets.", - location); + getLocation()); } // check if tar is out of date with respect to each @@ -275,7 +275,7 @@ public class Tar extends MatchingTask { if (tarFile.equals(new File(fs.getDir(getProject()), files[i]))) { throw new BuildException("A tar file cannot include " - + "itself", location); + + "itself", getLocation()); } } } @@ -324,7 +324,7 @@ public class Tar extends MatchingTask { } } catch (IOException ioe) { String msg = "Problem creating TAR: " + ioe.getMessage(); - throw new BuildException(msg, ioe, location); + throw new BuildException(msg, ioe, getLocation()); } finally { if (tOut != null) { try { @@ -394,7 +394,7 @@ public class Tar extends MatchingTask { } else if (longFileMode.isFailMode()) { throw new BuildException( "Entry: " + vPath + " longer than " + - TarConstants.NAMELEN + "characters.", location); + TarConstants.NAMELEN + "characters.", getLocation()); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Touch.java b/src/main/org/apache/tools/ant/taskdefs/Touch.java index e91e04b67..65b338218 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Touch.java +++ b/src/main/org/apache/tools/ant/taskdefs/Touch.java @@ -164,7 +164,7 @@ public class Touch extends Task { + "00:00:00 GMT)."); } } catch (ParseException pe) { - throw new BuildException(pe.getMessage(), pe, location); + throw new BuildException(pe.getMessage(), pe, getLocation()); } } @@ -185,7 +185,7 @@ public class Touch extends Task { fileUtils.createNewFile(file); } catch (IOException ioe) { throw new BuildException("Could not create " + file, ioe, - location); + getLocation()); } } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Tstamp.java b/src/main/org/apache/tools/ant/taskdefs/Tstamp.java index 3deb5f1d8..87a968302 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Tstamp.java +++ b/src/main/org/apache/tools/ant/taskdefs/Tstamp.java @@ -112,7 +112,7 @@ public class Tstamp extends Task { Enumeration i = customFormats.elements(); while (i.hasMoreElements()) { CustomFormat cts = (CustomFormat) i.nextElement(); - cts.execute(getProject(), d, location); + cts.execute(getProject(), d, getLocation()); } SimpleDateFormat dstamp = new SimpleDateFormat ("yyyyMMdd"); diff --git a/src/main/org/apache/tools/ant/taskdefs/Unpack.java b/src/main/org/apache/tools/ant/taskdefs/Unpack.java index e24d13e6d..9d23b8cfc 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Unpack.java +++ b/src/main/org/apache/tools/ant/taskdefs/Unpack.java @@ -116,15 +116,15 @@ public abstract class Unpack extends Task { private void validate() throws BuildException { if (source == null) { - throw new BuildException("No Src specified", location); + throw new BuildException("No Src specified", getLocation()); } if (!source.exists()) { - throw new BuildException("Src doesn't exist", location); + throw new BuildException("Src doesn't exist", getLocation()); } if (source.isDirectory()) { - throw new BuildException("Cannot expand a directory", location); + throw new BuildException("Cannot expand a directory", getLocation()); } if (dest == null) { diff --git a/src/main/org/apache/tools/ant/taskdefs/Untar.java b/src/main/org/apache/tools/ant/taskdefs/Untar.java index 8fb46eddd..663172051 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Untar.java +++ b/src/main/org/apache/tools/ant/taskdefs/Untar.java @@ -130,7 +130,7 @@ public class Untar extends Expand { } catch (IOException ioe) { throw new BuildException("Error while expanding " + srcF.getPath(), - ioe, location); + ioe, getLocation()); } finally { if (tis != null) { try { diff --git a/src/main/org/apache/tools/ant/taskdefs/UpToDate.java b/src/main/org/apache/tools/ant/taskdefs/UpToDate.java index 7f23cc111..615303d06 100644 --- a/src/main/org/apache/tools/ant/taskdefs/UpToDate.java +++ b/src/main/org/apache/tools/ant/taskdefs/UpToDate.java @@ -154,7 +154,7 @@ public class UpToDate extends Task implements Condition { public Mapper createMapper() throws BuildException { if (mapperElement != null) { throw new BuildException("Cannot define more than one mapper", - location); + getLocation()); } mapperElement = new Mapper(getProject()); return mapperElement; @@ -225,7 +225,7 @@ public class UpToDate extends Task implements Condition { public void execute() throws BuildException { if (_property == null) { throw new BuildException("property attribute is required.", - location); + getLocation()); } boolean upToDate = eval(); if (upToDate) { diff --git a/src/main/org/apache/tools/ant/taskdefs/War.java b/src/main/org/apache/tools/ant/taskdefs/War.java index fc89b2661..1eb3a358b 100644 --- a/src/main/org/apache/tools/ant/taskdefs/War.java +++ b/src/main/org/apache/tools/ant/taskdefs/War.java @@ -164,7 +164,7 @@ public class War extends Jar { throws IOException, BuildException { // If no webxml file is specified, it's an error. if (deploymentDescriptor == null && !isInUpdateMode()) { - throw new BuildException("webxml attribute is required", location); + throw new BuildException("webxml attribute is required", getLocation()); } super.initZipOutputStream(zOut); diff --git a/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java b/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java index 8a2342fb4..eeb6295e6 100644 --- a/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java +++ b/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java @@ -188,7 +188,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { String[] dirs; if (xslFile == null) { - throw new BuildException("no stylesheet specified", location); + throw new BuildException("no stylesheet specified", getLocation()); } try { diff --git a/src/main/org/apache/tools/ant/taskdefs/Zip.java b/src/main/org/apache/tools/ant/taskdefs/Zip.java index 4ccdafd7a..a82284199 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Zip.java +++ b/src/main/org/apache/tools/ant/taskdefs/Zip.java @@ -433,7 +433,7 @@ public class Zip extends MatchingTask { } } - throw new BuildException(msg, ioe, location); + throw new BuildException(msg, ioe, getLocation()); } finally { cleanUp(); } @@ -586,7 +586,7 @@ public class Zip extends MatchingTask { } catch (IOException ioe) { throw new BuildException("Could not create empty ZIP archive " + "(" + ioe.getMessage() + ")", ioe, - location); + getLocation()); } finally { if (os != null) { try { @@ -620,7 +620,7 @@ public class Zip extends MatchingTask { } else if (emptyBehavior.equals("fail")) { throw new BuildException("Cannot create " + archiveType + " archive " + zipFile + - ": no files were included.", location); + ": no files were included.", getLocation()); } else { // Create. return createEmptyZip(zipFile); @@ -629,7 +629,7 @@ public class Zip extends MatchingTask { for (int i = 0; i < files.length; ++i) { if (files[i].equals(zipFile)) { throw new BuildException("A zip file cannot include " - + "itself", location); + + "itself", getLocation()); } } @@ -793,7 +793,7 @@ public class Zip extends MatchingTask { throws IOException { if (file.equals(zipFile)) { throw new BuildException("A zip file cannot include itself", - location); + getLocation()); } FileInputStream fIn = new FileInputStream(file); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java b/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java index 706f6bf10..2812635e7 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java @@ -273,7 +273,7 @@ public class ANTLR extends Task { log(commandline.describeCommand(), Project.MSG_VERBOSE); int err = run(commandline.getCommandline()); if (err == 1) { - throw new BuildException("ANTLR returned: " + err, location); + throw new BuildException("ANTLR returned: " + err, getLocation()); } } else { log("Skipped grammar file. Generated file is newer.", Project.MSG_VERBOSE); @@ -364,7 +364,7 @@ public class ANTLR extends Task { try { return exe.execute(); } catch (IOException e) { - throw new BuildException(e, location); + throw new BuildException(e, getLocation()); } } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java b/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java index f29d9ea7b..db125e6b9 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java @@ -248,7 +248,7 @@ public class EchoProperties extends Task { if (inFile.exists() && inFile.isDirectory()) { String message = "srcfile is a directory!"; if (failonerror) { - throw new BuildException(message, location); + throw new BuildException(message, getLocation()); } else { log(message, Project.MSG_ERR); } @@ -258,7 +258,7 @@ public class EchoProperties extends Task { if (inFile.exists() && !inFile.canRead()) { String message = "Can not read from the specified srcfile!"; if (failonerror) { - throw new BuildException( message, location ); + throw new BuildException( message, getLocation() ); } else { log( message, Project.MSG_ERR ); } @@ -275,7 +275,7 @@ public class EchoProperties extends Task { String message = "Could not find file " + inFile.getAbsolutePath(); if (failonerror) { - throw new BuildException(message, fnfe, location); + throw new BuildException(message, fnfe, getLocation()); } else { log( message, Project.MSG_WARN ); } @@ -284,7 +284,7 @@ public class EchoProperties extends Task { String message = "Could not read file " + inFile.getAbsolutePath(); if (failonerror) { - throw new BuildException(message, ioe, location); + throw new BuildException(message, ioe, getLocation()); } else { log( message, Project.MSG_WARN ); } @@ -308,7 +308,7 @@ public class EchoProperties extends Task { if (destfile.exists() && destfile.isDirectory()) { String message = "destfile is a directory!"; if (failonerror) { - throw new BuildException(message, location); + throw new BuildException(message, getLocation()); } else { log(message, Project.MSG_ERR); } @@ -319,7 +319,7 @@ public class EchoProperties extends Task { String message = "Can not write to the specified destfile!"; if (failonerror) { - throw new BuildException(message, location); + throw new BuildException(message, getLocation()); } else { log(message, Project.MSG_ERR); } @@ -330,7 +330,7 @@ public class EchoProperties extends Task { } } catch (IOException ioe) { if (failonerror) { - throw new BuildException(ioe, location); + throw new BuildException(ioe, getLocation()); } else { log(ioe.getMessage(), Project.MSG_INFO); } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java b/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java index 4eb572650..327d4e507 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java @@ -654,22 +654,22 @@ public class IContract extends MatchingTask { /** Checks that the required attributes are set. */ private void preconditions() throws BuildException { if (srcDir == null) { - throw new BuildException("srcdir attribute must be set!", location); + throw new BuildException("srcdir attribute must be set!", getLocation()); } if (!srcDir.exists()) { - throw new BuildException("srcdir \"" + srcDir.getPath() + "\" does not exist!", location); + throw new BuildException("srcdir \"" + srcDir.getPath() + "\" does not exist!", getLocation()); } if (instrumentDir == null) { - throw new BuildException("instrumentdir attribute must be set!", location); + throw new BuildException("instrumentdir attribute must be set!", getLocation()); } if (repositoryDir == null) { - throw new BuildException("repositorydir attribute must be set!", location); + throw new BuildException("repositorydir attribute must be set!", getLocation()); } if (updateIcontrol == true && classDir == null) { - throw new BuildException("classdir attribute must be specified when updateicontrol=true!", location); + throw new BuildException("classdir attribute must be specified when updateicontrol=true!", getLocation()); } if (updateIcontrol == true && controlFile == null) { - throw new BuildException("controlfile attribute must be specified when updateicontrol=true!", location); + throw new BuildException("controlfile attribute must be specified when updateicontrol=true!", getLocation()); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java b/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java index 871b798a5..ac23d05ac 100755 --- a/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java @@ -283,19 +283,19 @@ public class Javah extends Task { // first off, make sure that we've got a srcdir if ((cls == null) && (classes.size() == 0)) { - throw new BuildException("class attribute must be set!", location); + throw new BuildException("class attribute must be set!", getLocation()); } if ((cls != null) && (classes.size() > 0)) { - throw new BuildException("set class attribute or class element, not both.", location); + throw new BuildException("set class attribute or class element, not both.", getLocation()); } if (destDir != null) { if (!destDir.isDirectory()) { - throw new BuildException("destination directory \"" + destDir + "\" does not exist or is not a directory", location); + throw new BuildException("destination directory \"" + destDir + "\" does not exist or is not a directory", getLocation()); } if (outputFile != null) { - throw new BuildException("destdir and outputFile are mutually exclusive", location); + throw new BuildException("destdir and outputFile are mutually exclusive", getLocation()); } } @@ -350,7 +350,7 @@ public class Javah extends Task { if (ex instanceof BuildException) { throw (BuildException) ex; } else { - throw new BuildException("Error starting javah: " + ex, ex, location); + throw new BuildException("Error starting javah: " + ex, ex, getLocation()); } } } @@ -396,7 +396,7 @@ public class Javah extends Task { if (stubs) { if (!old) { - throw new BuildException("stubs only available in old mode.", location); + throw new BuildException("stubs only available in old mode.", getLocation()); } cmd.createArgument().setValue("-stubs"); } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java b/src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java index 547b2acf7..26aaa05db 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java @@ -140,7 +140,7 @@ public class Native2Ascii extends MatchingTask { public Mapper createMapper() throws BuildException { if (mapper != null) { throw new BuildException("Cannot define more than one mapper", - location); + getLocation()); } mapper = new Mapper(getProject()); return mapper; diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java b/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java index 798e578df..bdb014e1e 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java @@ -235,7 +235,7 @@ public class PropertyFile extends Task { private void checkParameters() throws BuildException { if (!checkParam(propertyfile)) { - throw new BuildException("file token must not be null.", location); + throw new BuildException("file token must not be null.", getLocation()); } } @@ -270,12 +270,12 @@ public class PropertyFile extends Task { properties.save(bos, comment); } catch (InvocationTargetException ite) { Throwable t = ite.getTargetException(); - throw new BuildException(t, location); + throw new BuildException(t, getLocation()); } catch (IllegalAccessException iae) { // impossible - throw new BuildException(iae, location); + throw new BuildException(iae, getLocation()); } catch (IOException ioe) { - throw new BuildException(ioe, location); + throw new BuildException(ioe, getLocation()); } finally { if (bos != null) { try { diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/RenameExtensions.java b/src/main/org/apache/tools/ant/taskdefs/optional/RenameExtensions.java index 71dafdc6b..593971701 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/RenameExtensions.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/RenameExtensions.java @@ -152,7 +152,7 @@ public class RenameExtensions extends MatchingTask { Project.MSG_INFO); Move move = (Move) getProject().createTask("move"); - move.setOwningTarget(target); + move.setOwningTarget(getOwningTarget()); move.setTaskName(getTaskName()); move.setLocation(getLocation()); move.setTodir(srcDir); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java b/src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java index 10ccec2b0..71871eb69 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java @@ -150,7 +150,7 @@ public class Rpm extends Task { try { outputstream = new PrintStream(new BufferedOutputStream(new FileOutputStream(output))); } catch (IOException e) { - throw new BuildException(e, location); + throw new BuildException(e, getLocation()); } } else { outputstream = new LogOutputStream(this, Project.MSG_INFO); @@ -159,7 +159,7 @@ public class Rpm extends Task { try { errorstream = new PrintStream(new BufferedOutputStream(new FileOutputStream(error))); } catch (IOException e) { - throw new BuildException(e, location); + throw new BuildException(e, getLocation()); } } else { errorstream = new LogOutputStream(this, Project.MSG_WARN); @@ -180,7 +180,7 @@ public class Rpm extends Task { exe.execute(); log("Building the RPM based on the " + specFile + " file"); } catch (IOException e) { - throw new BuildException(e, location); + throw new BuildException(e, getLocation()); } finally { if (output != null) { try { @@ -218,7 +218,7 @@ public class Rpm extends Task { */ public void setSpecFile(String sf) { if ((sf == null) || (sf.trim().equals(""))) { - throw new BuildException("You must specify a spec file", location); + throw new BuildException("You must specify a spec file", getLocation()); } this.specFile = sf; } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java b/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java index 5db036377..302f0397c 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java @@ -149,7 +149,7 @@ public class CCMCheck extends Continuus { result = run(commandLine); if (result != 0) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java index 7e75a2bb9..54d5d2164 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java @@ -110,7 +110,7 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler { result = run(commandLine, this); if (result != 0) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } //create task ok, set this task as the default one @@ -124,7 +124,7 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler { result = run(commandLine2); if (result != 0) { String msg = "Failed executing: " + commandLine2.toString(); - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMReconfigure.java b/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMReconfigure.java index e23c403b2..3c2ed151b 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMReconfigure.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMReconfigure.java @@ -98,7 +98,7 @@ public class CCMReconfigure extends Continuus { result = run(commandLine); if (result != 0) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java b/src/main/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java index fede3806b..16d6f0a09 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java @@ -130,7 +130,7 @@ public abstract class Continuus extends Task { exe.setCommandline(cmd.getCommandline()); return exe.execute(); } catch (java.io.IOException e) { - throw new BuildException(e, location); + throw new BuildException(e, getLocation()); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckin.java b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckin.java index ea11c4fc7..9a17eaef8 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckin.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckin.java @@ -146,7 +146,7 @@ public class CCCheckin extends ClearCase { result = run(commandLine); if (result != 0) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckout.java b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckout.java index 4f3602f87..956f3f42a 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckout.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckout.java @@ -158,7 +158,7 @@ public class CCCheckout extends ClearCase { result = run(commandLine); if (result != 0) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUnCheckout.java b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUnCheckout.java index e9f4f1f0d..304cfa83f 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUnCheckout.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUnCheckout.java @@ -116,7 +116,7 @@ public class CCUnCheckout extends ClearCase { result = run(commandLine); if (result != 0) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUpdate.java b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUpdate.java index 04722c807..60962ebc9 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUpdate.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUpdate.java @@ -151,7 +151,7 @@ public class CCUpdate extends ClearCase { result = run(commandLine); if (result != 0) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java index 691a85b50..b517edb54 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java @@ -134,7 +134,7 @@ public abstract class ClearCase extends Task { exe.setCommandline(cmd.getCommandline()); return exe.execute(); } catch (java.io.IOException e) { - throw new BuildException(e, location); + throw new BuildException(e, getLocation()); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java b/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java index 72029553d..b4c2e5ba8 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java @@ -638,14 +638,14 @@ public class Depend extends MatchingTask { try { long start = System.currentTimeMillis(); if (srcPath == null) { - throw new BuildException("srcdir attribute must be set", - location); + throw new BuildException("srcdir attribute must be set", + getLocation()); } srcPathList = srcPath.list(); if (srcPathList.length == 0) { - throw new BuildException("srcdir attribute must be non-empty", - location); + throw new BuildException("srcdir attribute must be non-empty", + getLocation()); } if (destPath == null) { diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbcTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbcTask.java index a729e55a4..a8a18355d 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbcTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbcTask.java @@ -239,34 +239,34 @@ public class IPlanetEjbcTask extends Task { if (ejbdescriptor == null) { String msg = "The standard EJB descriptor must be specified using " + "the \"ejbdescriptor\" attribute."; - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } if ((!ejbdescriptor.exists()) || (!ejbdescriptor.isFile())) { String msg = "The standard EJB descriptor (" + ejbdescriptor + ") was not found or isn't a file."; - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } if (iasdescriptor == null) { String msg = "The iAS-speific XML descriptor must be specified using" + " the \"iasdescriptor\" attribute."; - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } if ((!iasdescriptor.exists()) || (!iasdescriptor.isFile())) { String msg = "The iAS-specific XML descriptor (" + iasdescriptor + ") was not found or isn't a file."; - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } if (dest == null) { String msg = "The destination directory must be specified using " + "the \"dest\" attribute."; - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } if ((!dest.exists()) || (!dest.isDirectory())) { String msg = "The destination directory (" + dest + ") was not " + "found or isn't a directory."; - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } if ((iashome != null) && (!iashome.isDirectory())) { @@ -291,10 +291,10 @@ public class IPlanetEjbcTask extends Task { saxParser = saxParserFactory.newSAXParser(); } catch (SAXException e) { String msg = "Unable to create a SAXParser: " + e.getMessage(); - throw new BuildException(msg, e, location); + throw new BuildException(msg, e, getLocation()); } catch (ParserConfigurationException e) { String msg = "Unable to create a SAXParser: " + e.getMessage(); - throw new BuildException(msg, e, location); + throw new BuildException(msg, e, getLocation()); } return saxParser; @@ -325,15 +325,15 @@ public class IPlanetEjbcTask extends Task { } catch (IOException e) { String msg = "An IOException occurred while trying to read the XML " + "descriptor file: " + e.getMessage(); - throw new BuildException(msg, e, location); + throw new BuildException(msg, e, getLocation()); } catch (SAXException e) { String msg = "A SAXException occurred while trying to read the XML " + "descriptor file: " + e.getMessage(); - throw new BuildException(msg, e, location); + throw new BuildException(msg, e, getLocation()); } catch (IPlanetEjbc.EjbcException e) { String msg = "An exception occurred while trying to run the ejbc " + "utility: " + e.getMessage(); - throw new BuildException(msg, e, location); + throw new BuildException(msg, e, getLocation()); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java b/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java index 82bf63532..5f09a4293 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java @@ -248,29 +248,29 @@ public class Translate extends MatchingTask { public void execute() throws BuildException { if (bundle == null) { throw new BuildException("The bundle attribute must be set.", - location); + getLocation()); } if (startToken == null) { throw new BuildException("The starttoken attribute must be set.", - location); + getLocation()); } if (startToken.length() != 1) { throw new BuildException( "The starttoken attribute must be a single character.", - location); + getLocation()); } if (endToken == null) { throw new BuildException("The endtoken attribute must be set.", - location); + getLocation()); } if (endToken.length() != 1) { throw new BuildException( "The endtoken attribute must be a single character.", - location); + getLocation()); } if (bundleLanguage == null) { @@ -289,7 +289,7 @@ public class Translate extends MatchingTask { if (toDir == null) { throw new BuildException("The todir attribute must be set.", - location); + getLocation()); } if (!toDir.exists()) { @@ -405,7 +405,7 @@ public class Translate extends MatchingTask { //have been scanned for and still not able to //find a single resrouce file, throw exception if (!loaded && checkLoaded) { - throw new BuildException(ioe.getMessage(), location); + throw new BuildException(ioe.getMessage(), getLocation()); } } } @@ -463,7 +463,7 @@ public class Translate extends MatchingTask { in.close(); } } catch (IOException ioe) { - throw new BuildException(ioe.getMessage(), location); + throw new BuildException(ioe.getMessage(), getLocation()); } } @@ -579,7 +579,7 @@ outer: while (true) { Project.MSG_VERBOSE); } } catch (IOException ioe) { - throw new BuildException(ioe.getMessage(), location); + throw new BuildException(ioe.getMessage(), getLocation()); } } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java index d7f1e57e6..051a29ad6 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java @@ -303,7 +303,7 @@ public class JDependTask extends Task { if (errorOccurred) { if (getHaltonerror()) { throw new BuildException("JDepend failed", - location); + getLocation()); } else { log("JDepend FAILED", Project.MSG_ERR); } @@ -426,7 +426,7 @@ public class JDependTask extends Task { try { return execute.execute(); } catch (IOException e) { - throw new BuildException("Process fork failed.", e, location); + throw new BuildException("Process fork failed.", e, getLocation()); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/jlink/JlinkTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/jlink/JlinkTask.java index f698b6cf6..e6fb10bf9 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/jlink/JlinkTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/jlink/JlinkTask.java @@ -177,7 +177,7 @@ public class JlinkTask extends MatchingTask { try { linker.link(); } catch (Exception ex) { - throw new BuildException(ex, location); + throw new BuildException(ex, getLocation()); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java b/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java index f63caa9ca..37389641e 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java @@ -402,19 +402,19 @@ public class JspC extends MatchingTask { // first off, make sure that we've got a srcdir if (src == null) { throw new BuildException("srcdir attribute must be set!", - location); + getLocation()); } String [] list = src.list(); if (list.length == 0) { throw new BuildException("srcdir attribute must be set!", - location); + getLocation()); } if (destDir != null && !destDir.isDirectory()) { throw new BuildException("destination directory \"" + destDir + "\" does not exist or is not a directory", - location); + getLocation()); } File dest = getActualDestDir(); @@ -441,7 +441,7 @@ public class JspC extends MatchingTask { File srcDir = (File) getProject().resolveFile(list[i]); if (!srcDir.exists()) { throw new BuildException("srcdir \"" + srcDir.getPath() + - "\" does not exist!", location); + "\" does not exist!", getLocation()); } DirectoryScanner ds = this.getDirectoryScanner(srcDir); String[] files = ds.getIncludedFiles(); @@ -497,7 +497,7 @@ public class JspC extends MatchingTask { // finally, lets execute the compiler!! if (!compiler.execute()) { if (failOnError) { - throw new BuildException(FAIL_MSG, location); + throw new BuildException(FAIL_MSG, getLocation()); } else { log(FAIL_MSG, Project.MSG_ERR); } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java b/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java index b3cdfc460..a42be7d91 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java @@ -139,7 +139,7 @@ public class WLJspc extends MatchingTask { } if (destinationPackage == null) { - throw new BuildException("package attribute must be present.", location); + throw new BuildException("package attribute must be present.", getLocation()); } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java index e5f8bf64c..b10ac816f 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java @@ -566,7 +566,7 @@ public class JUnitTask extends Task { if ((errorOccurredHere && test.getHaltonerror()) || (failureOccurredHere && test.getHaltonfailure())) { throw new BuildException("Test " + test.getName() + " failed" - + (wasKilled ? " (timeout)" : ""), location); + + (wasKilled ? " (timeout)" : ""), getLocation()); } else { log("TEST " + test.getName() + " FAILED" + (wasKilled ? " (timeout)" : ""), Project.MSG_ERR); @@ -651,7 +651,7 @@ public class JUnitTask extends Task { } catch (java.io.IOException e) { propsFile.delete(); throw new BuildException("Error creating temporary properties " - + "file.", e, location); + + "file.", e, getLocation()); } Execute execute = new Execute(new LogStreamHandler(this, @@ -679,7 +679,7 @@ public class JUnitTask extends Task { try { retVal = execute.execute(); } catch (IOException e) { - throw new BuildException("Process fork failed.", e, location); + throw new BuildException("Process fork failed.", e, getLocation()); } finally { if (!propsFile.delete()) { throw new BuildException("Could not delete temporary " diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java b/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java index 299c4ca55..a2a008e6e 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java @@ -144,7 +144,7 @@ public class Pvcs extends org.apache.tools.ant.Task { } catch (java.io.IOException e) { String msg = "Failed executing: " + cmd.toString() + ". Exception: " + e.getMessage(); - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } } @@ -231,7 +231,7 @@ public class Pvcs extends org.apache.tools.ant.Task { if (result != 0 && !ignorerc) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } if (!tmp.exists()) { @@ -278,21 +278,21 @@ public class Pvcs extends org.apache.tools.ant.Task { if (result != 0 && !ignorerc) { String msg = "Failed executing: " + commandLine.toString() + ". Return code was " + result; - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } } catch (FileNotFoundException e) { String msg = "Failed executing: " + commandLine.toString() + ". Exception: " + e.getMessage(); - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } catch (IOException e) { String msg = "Failed executing: " + commandLine.toString() + ". Exception: " + e.getMessage(); - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } catch (ParseException e) { String msg = "Failed executing: " + commandLine.toString() + ". Exception: " + e.getMessage(); - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } finally { if (tmp != null) { tmp.delete(); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOS.java b/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOS.java index 04ba520e2..e61d80683 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOS.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOS.java @@ -464,7 +464,7 @@ public abstract class SOS extends Task { if (!done) { String msg = "Directory " + localPath + " creation was not " + "successful for an unknown reason"; - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } getProject().log("Created dir: " + dir.getAbsolutePath()); } @@ -491,7 +491,7 @@ public abstract class SOS extends Task { exe.setCommandline(cmd.getCommandline()); return exe.execute(); } catch (java.io.IOException e) { - throw new BuildException(e, location); + throw new BuildException(e, getLocation()); } } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOSCheckin.java b/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOSCheckin.java index 349daff98..f76791a61 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOSCheckin.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOSCheckin.java @@ -161,7 +161,7 @@ public class SOSCheckin extends SOS { if (result == 255) { // This is the exit status String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } } @@ -200,13 +200,13 @@ public class SOSCheckin extends SOS { } // SOS server address is required if (getSosServerPath() == null) { - throw new BuildException("sosserverpath attribute must be set!", location); + throw new BuildException("sosserverpath attribute must be set!", getLocation()); } commandLine.createArgument().setValue(SOSCmd.FLAG_SOS_SERVER); commandLine.createArgument().setValue(getSosServerPath()); // Login info is required if (getUsername() == null) { - throw new BuildException("username attribute must be set!", location); + throw new BuildException("username attribute must be set!", getLocation()); } commandLine.createArgument().setValue(SOSCmd.FLAG_USERNAME); commandLine.createArgument().setValue(getUsername()); @@ -216,13 +216,13 @@ public class SOSCheckin extends SOS { commandLine.createArgument().setValue(getPassword()); // VSS Info is required if (getVssServerPath() == null) { - throw new BuildException("vssserverpath attribute must be set!", location); + throw new BuildException("vssserverpath attribute must be set!", getLocation()); } commandLine.createArgument().setValue(SOSCmd.FLAG_VSS_SERVER); commandLine.createArgument().setValue(getVssServerPath()); // VSS project is required if (getProjectPath() == null) { - throw new BuildException("projectpath attribute must be set!", location); + throw new BuildException("projectpath attribute must be set!", getLocation()); } commandLine.createArgument().setValue(SOSCmd.FLAG_PROJECT); commandLine.createArgument().setValue(getProjectPath()); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOSCheckout.java b/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOSCheckout.java index 3ea44bc18..16f10c85a 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOSCheckout.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOSCheckout.java @@ -157,7 +157,7 @@ public class SOSCheckout extends SOS { if (result == 255) { // This is the exit status String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } } @@ -195,13 +195,13 @@ public class SOSCheckout extends SOS { } // SOS server address is required if (getSosServerPath() == null) { - throw new BuildException("sosserverpath attribute must be set!", location); + throw new BuildException("sosserverpath attribute must be set!", getLocation()); } commandLine.createArgument().setValue(SOSCmd.FLAG_SOS_SERVER); commandLine.createArgument().setValue(getSosServerPath()); // Login info is required if (getUsername() == null) { - throw new BuildException("username attribute must be set!", location); + throw new BuildException("username attribute must be set!", getLocation()); } commandLine.createArgument().setValue(SOSCmd.FLAG_USERNAME); commandLine.createArgument().setValue(getUsername()); @@ -211,13 +211,13 @@ public class SOSCheckout extends SOS { commandLine.createArgument().setValue(getPassword()); // VSS Info is required if (getVssServerPath() == null) { - throw new BuildException("vssserverpath attribute must be set!", location); + throw new BuildException("vssserverpath attribute must be set!", getLocation()); } commandLine.createArgument().setValue(SOSCmd.FLAG_VSS_SERVER); commandLine.createArgument().setValue(getVssServerPath()); // VSS project is required if (getProjectPath() == null) { - throw new BuildException("projectpath attribute must be set!", location); + throw new BuildException("projectpath attribute must be set!", getLocation()); } commandLine.createArgument().setValue(SOSCmd.FLAG_PROJECT); commandLine.createArgument().setValue(getProjectPath()); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOSGet.java b/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOSGet.java index 6aa1462fa..5ccd25ea6 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOSGet.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOSGet.java @@ -168,7 +168,7 @@ public class SOSGet extends SOS { if (result == 255) { // This is the exit status String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } } @@ -217,13 +217,13 @@ public class SOSGet extends SOS { } // SOS server address is required if (getSosServerPath() == null) { - throw new BuildException("sosserverpath attribute must be set!", location); + throw new BuildException("sosserverpath attribute must be set!", getLocation()); } commandLine.createArgument().setValue(SOSCmd.FLAG_SOS_SERVER); commandLine.createArgument().setValue(getSosServerPath()); // Login info is required if (getUsername() == null) { - throw new BuildException("username attribute must be set!", location); + throw new BuildException("username attribute must be set!", getLocation()); } commandLine.createArgument().setValue(SOSCmd.FLAG_USERNAME); commandLine.createArgument().setValue(getUsername()); @@ -233,13 +233,13 @@ public class SOSGet extends SOS { commandLine.createArgument().setValue(getPassword()); // VSS Info is required if (getVssServerPath() == null) { - throw new BuildException("vssserverpath attribute must be set!", location); + throw new BuildException("vssserverpath attribute must be set!", getLocation()); } commandLine.createArgument().setValue(SOSCmd.FLAG_VSS_SERVER); commandLine.createArgument().setValue(getVssServerPath()); // SS project path is required if (getProjectPath() == null) { - throw new BuildException("projectpath attribute must be set!", location); + throw new BuildException("projectpath attribute must be set!", getLocation()); } commandLine.createArgument().setValue(SOSCmd.FLAG_PROJECT); commandLine.createArgument().setValue(getProjectPath()); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOSLabel.java b/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOSLabel.java index 5a4066352..f46dcd02a 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOSLabel.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOSLabel.java @@ -135,7 +135,7 @@ public class SOSLabel extends SOS { if (result == 255) { // This is the exit status String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } } @@ -156,13 +156,13 @@ public class SOSLabel extends SOS { commandLine.createArgument().setValue(SOSCmd.COMMAND_LABEL); // SOS server address is required if (getSosServerPath() == null) { - throw new BuildException("sosserverpath attribute must be set!", location); + throw new BuildException("sosserverpath attribute must be set!", getLocation()); } commandLine.createArgument().setValue(SOSCmd.FLAG_SOS_SERVER); commandLine.createArgument().setValue(getSosServerPath()); // Login info is required if (getUsername() == null) { - throw new BuildException("username attribute must be set!", location); + throw new BuildException("username attribute must be set!", getLocation()); } commandLine.createArgument().setValue(SOSCmd.FLAG_USERNAME); commandLine.createArgument().setValue(getUsername()); @@ -172,19 +172,19 @@ public class SOSLabel extends SOS { commandLine.createArgument().setValue(getPassword()); // VSS Info is required if (getVssServerPath() == null) { - throw new BuildException("vssserverpath attribute must be set!", location); + throw new BuildException("vssserverpath attribute must be set!", getLocation()); } commandLine.createArgument().setValue(SOSCmd.FLAG_VSS_SERVER); commandLine.createArgument().setValue(getVssServerPath()); // SS project path is required if (getProjectPath() == null) { - throw new BuildException("projectpath attribute must be set!", location); + throw new BuildException("projectpath attribute must be set!", getLocation()); } commandLine.createArgument().setValue(SOSCmd.FLAG_PROJECT); commandLine.createArgument().setValue(getProjectPath()); // a label is required if (getLabel() == null) { - throw new BuildException("label attribute must be set!", location); + throw new BuildException("label attribute must be set!", getLocation()); } commandLine.createArgument().setValue(SOSCmd.FLAG_LABEL); commandLine.createArgument().setValue(getLabel()); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java b/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java index 3cd677218..02e4ac462 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java @@ -192,7 +192,7 @@ public abstract class MSVSS extends Task { exe.setCommandline(cmd.getCommandline()); return exe.execute(); } catch (java.io.IOException e) { - throw new BuildException(e, location); + throw new BuildException(e, getLocation()); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSADD.java b/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSADD.java index 4fa00e582..4b588a73d 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSADD.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSADD.java @@ -86,7 +86,7 @@ public class MSVSSADD extends MSVSS { // first off, make sure that we've got a command and a localPath ... if (getLocalPath() == null) { String msg = "localPath attribute must be set!"; - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } // now look for illegal combinations of things ... @@ -113,7 +113,7 @@ public class MSVSSADD extends MSVSS { result = run(commandLine); if (result != 0) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java b/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java index 435bcbfc0..c426f0911 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java @@ -88,7 +88,7 @@ public class MSVSSCHECKIN extends MSVSS { // first off, make sure that we've got a command and a vssdir ... if (getVsspath() == null) { String msg = "vsspath attribute must be set!"; - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } // now look for illegal combinations of things ... @@ -117,7 +117,7 @@ public class MSVSSCHECKIN extends MSVSS { result = run(commandLine); if (result != 0) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } } @@ -145,7 +145,7 @@ public class MSVSSCHECKIN extends MSVSS { String msg = "Directory " + m_LocalPath + " creation was not " + "succesful for an unknown reason"; - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } getProject().log("Created dir: " + dir.getAbsolutePath()); } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKOUT.java b/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKOUT.java index 07715c3d8..f421f73eb 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKOUT.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKOUT.java @@ -90,7 +90,7 @@ public class MSVSSCHECKOUT extends MSVSS { // first off, make sure that we've got a command and a vssdir ... if (getVsspath() == null) { String msg = "vsspath attribute must be set!"; - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } // now look for illegal combinations of things ... @@ -117,7 +117,7 @@ public class MSVSSCHECKOUT extends MSVSS { result = run(commandLine); if (result != 0) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } } @@ -144,7 +144,7 @@ public class MSVSSCHECKOUT extends MSVSS { if (!done) { String msg = "Directory " + m_LocalPath + " creation was not " + "succesful for an unknown reason"; - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } getProject().log("Created dir: " + dir.getAbsolutePath()); } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCP.java b/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCP.java index 48e059fa3..b0546e8eb 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCP.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCP.java @@ -83,7 +83,7 @@ public class MSVSSCP extends MSVSS { // first off, make sure that we've got a command and a vssdir ... if (getVsspath() == null) { String msg = "vsspath attribute must be set!"; - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } // now look for illegal combinations of things ... @@ -104,7 +104,7 @@ public class MSVSSCP extends MSVSS { result = run(commandLine); if (result != 0) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCREATE.java b/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCREATE.java index 23567b39a..b8e1c6434 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCREATE.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCREATE.java @@ -137,7 +137,7 @@ public class MSVSSCREATE extends MSVSS { // first off, make sure that we've got a command and a vssdir... if (getVsspath() == null) { String msg = "vsspath attribute must be set!"; - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } // now look for illegal combinations of things ... @@ -166,7 +166,7 @@ public class MSVSSCREATE extends MSVSS { result = run(commandLine); if (result != 0 && m_FailOnError) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSGET.java b/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSGET.java index 48201dc5c..5692f2148 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSGET.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSGET.java @@ -153,7 +153,7 @@ public class MSVSSGET extends MSVSS { // first off, make sure that we've got a command and a vssdir ... if (getVsspath() == null) { String msg = "vsspath attribute must be set!"; - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } // now look for illegal combinations of things ... @@ -184,7 +184,7 @@ public class MSVSSGET extends MSVSS { result = run(commandLine); if (result != 0) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } } @@ -211,7 +211,7 @@ public class MSVSSGET extends MSVSS { if (!done) { String msg = "Directory " + m_LocalPath + " creation was not " + "successful for an unknown reason"; - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } getProject().log("Created dir: " + dir.getAbsolutePath()); } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSHISTORY.java b/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSHISTORY.java index 365a92906..0eb4407c0 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSHISTORY.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSHISTORY.java @@ -107,7 +107,7 @@ public class MSVSSHISTORY extends MSVSS { // first off, make sure that we've got a command and a vssdir and a label ... if (getVsspath() == null) { String msg = "vsspath attribute must be set!"; - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } // now look for illegal combinations of things ... @@ -150,7 +150,7 @@ public class MSVSSHISTORY extends MSVSS { result = run(commandLine); if (result != 0) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } } @@ -252,7 +252,7 @@ public class MSVSSHISTORY extends MSVSS { startDate = calcDate(m_ToDate, m_NumDays); } catch (ParseException ex) { String msg = "Error parsing date: " + m_ToDate; - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } cmd.createArgument().setValue(FLAG_VERSION_DATE + m_ToDate + VALUE_FROMDATE + startDate); } else if (m_FromDate != null && m_NumDays != Integer.MIN_VALUE) { @@ -261,7 +261,7 @@ public class MSVSSHISTORY extends MSVSS { endDate = calcDate(m_FromDate, m_NumDays); } catch (ParseException ex) { String msg = "Error parsing date: " + m_FromDate; - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } cmd.createArgument().setValue(FLAG_VERSION_DATE + endDate + VALUE_FROMDATE + m_FromDate); } else { diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSLABEL.java b/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSLABEL.java index a0fcc48fa..2f2a5b616 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSLABEL.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSLABEL.java @@ -133,11 +133,11 @@ public class MSVSSLABEL extends MSVSS { // first off, make sure that we've got a command and a vssdir and a label ... if (getVsspath() == null) { String msg = "vsspath attribute must be set!"; - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } if (getLabel() == null) { String msg = "label attribute must be set!"; - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } // now look for illegal combinations of things ... @@ -171,7 +171,7 @@ public class MSVSSLABEL extends MSVSS { result = run(commandLine); if (result != 0) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException(msg, location); + throw new BuildException(msg, getLocation()); } } |