git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277868 13f79535-47bb-0310-9956-ffa450edef68master
@@ -1,5 +1,5 @@ | |||
/* | |||
* Copyright 2004 The Apache Software Foundation | |||
* Copyright 2004-2005 The Apache Software Foundation | |||
* | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | |||
@@ -27,7 +27,7 @@ public class ExitStatusException extends BuildException { | |||
private int status; | |||
/** | |||
* Constructs an <CODE>ExitStatusException</CODE>. | |||
* Constructs an <code>ExitStatusException</code>. | |||
* @param status the associated status code | |||
*/ | |||
public ExitStatusException(int status) { | |||
@@ -36,7 +36,7 @@ public class ExitStatusException extends BuildException { | |||
} | |||
/** | |||
* Constructs an <CODE>ExitStatusException</CODE>. | |||
* Constructs an <code>ExitStatusException</code>. | |||
* @param msg the associated message | |||
* @param status the associated status code | |||
*/ | |||
@@ -47,9 +47,9 @@ public class ExitStatusException extends BuildException { | |||
/** | |||
* Get the status code. | |||
* @return <CODE>int</CODE> | |||
* @return <code>int</code> | |||
*/ | |||
public int getStatus() { | |||
return status; | |||
} | |||
} | |||
} |
@@ -1,5 +1,5 @@ | |||
/* | |||
* Copyright 2000-2004 The Apache Software Foundation | |||
* Copyright 2000-2005 The Apache Software Foundation | |||
* | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | |||
@@ -54,6 +54,7 @@ public class Target implements TaskContainer { | |||
/** Sole constructor. */ | |||
public Target() { | |||
//empty | |||
} | |||
/** | |||
@@ -79,7 +80,7 @@ public class Target implements TaskContainer { | |||
/** | |||
* Sets the location of this target's definition. | |||
* | |||
* @param location <CODE>Location</CODE> | |||
* @param location <code>Location</code> | |||
* @since 1.6.2 | |||
*/ | |||
public void setLocation(Location location) { | |||
@@ -89,7 +90,7 @@ public class Target implements TaskContainer { | |||
/** | |||
* Get the location of this target's definition. | |||
* | |||
* @return <CODE>Location</CODE> | |||
* @return <code>Location</code> | |||
* @since 1.6.2 | |||
*/ | |||
public Location getLocation() { | |||
@@ -208,11 +209,8 @@ public class Target implements TaskContainer { | |||
* @return an enumeration of the dependencies of this target | |||
*/ | |||
public Enumeration getDependencies() { | |||
if (dependencies != null) { | |||
return Collections.enumeration(dependencies); | |||
} else { | |||
return new CollectionUtils.EmptyEnumeration(); | |||
} | |||
return (dependencies != null ? Collections.enumeration(dependencies) | |||
: new CollectionUtils.EmptyEnumeration()); | |||
} | |||
/** | |||
@@ -224,7 +222,8 @@ public class Target implements TaskContainer { | |||
public boolean dependsOn(String other) { | |||
Project p = getProject(); | |||
Hashtable t = (p == null) ? null : p.getTargets(); | |||
return (p != null && p.topoSort(getName(), t, false).contains(t.get(other))); | |||
return (p != null | |||
&& p.topoSort(getName(), t, false).contains(t.get(other))); | |||
} | |||
/** | |||
@@ -439,4 +438,4 @@ public class Target implements TaskContainer { | |||
String test = project.replaceProperties(unlessCondition); | |||
return project.getProperty(test) == null; | |||
} | |||
} | |||
} |
@@ -39,10 +39,10 @@ public class StringInputStream extends ReaderInputStream { | |||
* Composes a stream from a String with the specified encoding | |||
* | |||
* @param source The string to read from. Must not be <code>null</code>. | |||
* @param encoding The encoding scheme. Also must not be <CODE>null</CODE>. | |||
* @param encoding The encoding scheme. Also must not be <code>null</code>. | |||
*/ | |||
public StringInputStream(String source, String encoding) { | |||
super(new StringReader(source), encoding); | |||
} | |||
} | |||
} |
@@ -1,5 +1,5 @@ | |||
/* | |||
* Copyright 2002-2004 The Apache Software Foundation | |||
* Copyright 2002-2005 The Apache Software Foundation | |||
* | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | |||
@@ -341,36 +341,36 @@ public abstract class AbstractCvsTask extends Task { | |||
+ retCode | |||
+ StringUtils.LINE_SEP | |||
+ "Command line was [" | |||
+ actualCommandLine + "]", getLocation()); | |||
+ actualCommandLine + "]", | |||
getLocation()); | |||
} | |||
} catch (IOException e) { | |||
if (failOnError) { | |||
throw new BuildException(e, getLocation()); | |||
} else { | |||
log("Caught exception: " + e.getMessage(), Project.MSG_WARN); | |||
} | |||
log("Caught exception: " + e.getMessage(), Project.MSG_WARN); | |||
} catch (BuildException e) { | |||
if (failOnError) { | |||
throw(e); | |||
} else { | |||
if (failOnError) { | |||
throw(e); | |||
} | |||
Throwable t = e.getException(); | |||
if (t == null) { | |||
t = e; | |||
t = e; | |||
} | |||
log("Caught exception: " + t.getMessage(), Project.MSG_WARN); | |||
} | |||
} catch (Exception e) { | |||
if (failOnError) { | |||
throw new BuildException(e, getLocation()); | |||
} else { | |||
if (failOnError) { | |||
throw new BuildException(e, getLocation()); | |||
} | |||
log("Caught exception: " + e.getMessage(), Project.MSG_WARN); | |||
} | |||
} | |||
} | |||
/** | |||
* do the work | |||
* @throws BuildException if failonerror is set to true and the cvs command fails. | |||
* @throws BuildException if failonerror is set to true and the | |||
* cvs command fails. | |||
*/ | |||
public void execute() throws BuildException { | |||
@@ -615,8 +615,8 @@ public abstract class AbstractCvsTask extends Task { | |||
/** | |||
* Use the most recent revision no later than the given date. | |||
* @param p a date as string in a format that the CVS executable can understand | |||
* see man cvs | |||
* @param p a date as string in a format that the CVS executable | |||
* can understand see man cvs | |||
*/ | |||
public void setDate(String p) { | |||
if (p != null && p.trim().length() > 0) { | |||
@@ -738,7 +738,8 @@ public abstract class AbstractCvsTask extends Task { | |||
if (cvsPackage != null) { | |||
c.createArgument().setLine(cvsPackage); | |||
} | |||
if (this.compression > 0 && this.compression <= MAXIMUM_COMRESSION_LEVEL) { | |||
if (this.compression > 0 | |||
&& this.compression <= MAXIMUM_COMRESSION_LEVEL) { | |||
c.createArgument(true).setValue("-z" + this.compression); | |||
} | |||
if (quiet && !reallyquiet) { | |||
@@ -79,7 +79,7 @@ public class Ant extends Task { | |||
private String antFile = null; | |||
/** the output */ | |||
private String output = null; | |||
private String output = null; | |||
/** should we inherit properties from the parent ? */ | |||
private boolean inheritAll = true; | |||
@@ -112,6 +112,7 @@ public class Ant extends Task { | |||
* simple constructor | |||
*/ | |||
public Ant() { | |||
//default | |||
} | |||
/** | |||
@@ -223,67 +224,61 @@ public class Ant extends Task { | |||
/** | |||
* @see Task#handleOutput(String) | |||
* | |||
* @since Ant 1.5 | |||
*/ | |||
public void handleOutput(String output) { | |||
public void handleOutput(String outputToHandle) { | |||
if (newProject != null) { | |||
newProject.demuxOutput(output, false); | |||
newProject.demuxOutput(outputToHandle, false); | |||
} else { | |||
super.handleOutput(output); | |||
super.handleOutput(outputToHandle); | |||
} | |||
} | |||
/** | |||
* @see Task#handleInput(byte[], int, int) | |||
* | |||
* @since Ant 1.6 | |||
*/ | |||
public int handleInput(byte[] buffer, int offset, int length) | |||
throws IOException { | |||
if (newProject != null) { | |||
return newProject.demuxInput(buffer, offset, length); | |||
} else { | |||
return super.handleInput(buffer, offset, length); | |||
} | |||
return super.handleInput(buffer, offset, length); | |||
} | |||
/** | |||
* @see Task#handleFlush(String) | |||
* | |||
* @since Ant 1.5.2 | |||
*/ | |||
public void handleFlush(String output) { | |||
public void handleFlush(String toFlush) { | |||
if (newProject != null) { | |||
newProject.demuxFlush(output, false); | |||
newProject.demuxFlush(toFlush, false); | |||
} else { | |||
super.handleFlush(output); | |||
super.handleFlush(toFlush); | |||
} | |||
} | |||
/** | |||
* @see Task#handleErrorOutput(String) | |||
* | |||
* @since Ant 1.5 | |||
*/ | |||
public void handleErrorOutput(String output) { | |||
public void handleErrorOutput(String errorOutputToHandle) { | |||
if (newProject != null) { | |||
newProject.demuxOutput(output, true); | |||
newProject.demuxOutput(errorOutputToHandle, true); | |||
} else { | |||
super.handleErrorOutput(output); | |||
super.handleErrorOutput(errorOutputToHandle); | |||
} | |||
} | |||
/** | |||
* @see Task#handleErrorFlush(String) | |||
* | |||
* @since Ant 1.5.2 | |||
*/ | |||
public void handleErrorFlush(String output) { | |||
public void handleErrorFlush(String errorOutputToFlush) { | |||
if (newProject != null) { | |||
newProject.demuxFlush(output, true); | |||
newProject.demuxFlush(errorOutputToFlush, true); | |||
} else { | |||
super.handleErrorFlush(output); | |||
super.handleErrorFlush(errorOutputToFlush); | |||
} | |||
} | |||
@@ -344,11 +339,10 @@ public class Ant extends Task { | |||
if (getTaskName().equals("antcall")) { | |||
throw new BuildException("antcall must not be used at" | |||
+ " the top level."); | |||
} else { | |||
throw new BuildException(getTaskName() + " task at the" | |||
+ " top level must not invoke" | |||
+ " its own build file."); | |||
} | |||
throw new BuildException(getTaskName() + " task at the" | |||
+ " top level must not invoke" | |||
+ " its own build file."); | |||
} | |||
} | |||
@@ -375,28 +369,29 @@ public class Ant extends Task { | |||
if (locals.contains(owningTargetName)) { | |||
throw new BuildException(getTaskName() + " task calling " | |||
+ "its own parent target."); | |||
} else { | |||
boolean circular = false; | |||
for (Iterator it = locals.iterator(); !circular && it.hasNext();) { | |||
Target other = (Target) (getProject().getTargets().get( | |||
(String) (it.next()))); | |||
circular |= (other != null | |||
&& other.dependsOn(owningTargetName)); | |||
} | |||
if (circular) { | |||
throw new BuildException(getTaskName() | |||
+ " task calling a target" | |||
+ " that depends on" | |||
+ " its parent target \'" | |||
+ owningTargetName | |||
+ "\'."); | |||
} | |||
} | |||
boolean circular = false; | |||
for (Iterator it = locals.iterator(); | |||
!circular && it.hasNext();) { | |||
Target other = | |||
(Target) (getProject().getTargets().get(it.next())); | |||
circular |= (other != null | |||
&& other.dependsOn(owningTargetName)); | |||
} | |||
if (circular) { | |||
throw new BuildException(getTaskName() | |||
+ " task calling a target" | |||
+ " that depends on" | |||
+ " its parent target \'" | |||
+ owningTargetName | |||
+ "\'."); | |||
} | |||
} | |||
addReferences(); | |||
if (locals.size() > 0 && !(locals.size() == 1 && locals.get(0) == "")) { | |||
if (locals.size() > 0 && !(locals.size() == 1 | |||
&& locals.get(0) == "")) { | |||
Throwable t = null; | |||
try { | |||
log("Entering " + antFile + "...", Project.MSG_VERBOSE); | |||
@@ -567,7 +562,8 @@ public class Ant extends Task { | |||
* Copies all properties from the given table to the new project - | |||
* omitting those that have already been set in the new project as | |||
* well as properties named basedir or ant.file. | |||
* @param props properties <code>Hashtable</code> to copy to the new project. | |||
* @param props properties <code>Hashtable</code> to copy to the | |||
* new project. | |||
* @since Ant 1.6 | |||
*/ | |||
private void addAlmostAll(Hashtable props) { | |||
@@ -593,10 +589,10 @@ public class Ant extends Task { | |||
* Defaults to the current project's basedir, unless inheritall | |||
* has been set to false, in which case it doesn't have a default | |||
* value. This will override the basedir setting of the called project. | |||
* @param d new directory as <code>File</code>. | |||
* @param dir new directory as <code>File</code>. | |||
*/ | |||
public void setDir(File d) { | |||
this.dir = d; | |||
public void setDir(File dir) { | |||
this.dir = dir; | |||
} | |||
/** | |||
@@ -604,23 +600,23 @@ public class Ant extends Task { | |||
* to be a filename relative to the dir attribute given. | |||
* @param s the <code>String</code> build file name. | |||
*/ | |||
public void setAntfile(String s) { | |||
public void setAntfile(String antFile) { | |||
// @note: it is a string and not a file to handle relative/absolute | |||
// otherwise a relative file will be resolved based on the current | |||
// basedir. | |||
this.antFile = s; | |||
this.antFile = antFile; | |||
} | |||
/** | |||
* The target of the new Ant project to execute. | |||
* Defaults to the new project's default target. | |||
* @param s the name of the target to invoke. | |||
* @param targetToAdd the name of the target to invoke. | |||
*/ | |||
public void setTarget(String s) { | |||
if (s.equals("")) { | |||
public void setTarget(String targetToAdd) { | |||
if (targetToAdd.equals("")) { | |||
throw new BuildException("target attribute must not be empty"); | |||
} | |||
targets.add(s); | |||
targets.add(targetToAdd); | |||
targetAttributeSet = true; | |||
} | |||
@@ -628,10 +624,10 @@ public class Ant extends Task { | |||
* Set the filename to write the output to. This is relative to the value | |||
* of the dir attribute if it has been set or to the base directory of the | |||
* current project otherwise. | |||
* @param s the name of the file to which the output should go. | |||
* @param outputFile the name of the file to which the output should go. | |||
*/ | |||
public void setOutput(String s) { | |||
this.output = s; | |||
public void setOutput(String outputFile) { | |||
this.output = outputFile; | |||
} | |||
/** | |||
@@ -653,15 +649,15 @@ public class Ant extends Task { | |||
/** | |||
* Add a Reference element identifying a data type to carry | |||
* over to the new project. | |||
* @param r <code>Reference</code> to add. | |||
* @param ref <code>Reference</code> to add. | |||
*/ | |||
public void addReference(Reference r) { | |||
references.addElement(r); | |||
public void addReference(Reference ref) { | |||
references.addElement(ref); | |||
} | |||
/** | |||
* Add a target to this Ant invocation. | |||
* @param t the <CODE>TargetElement</CODE> to add. | |||
* @param t the <code>TargetElement</code> to add. | |||
* @since Ant 1.6.3 | |||
*/ | |||
public void addConfiguredTarget(TargetElement t) { | |||
@@ -702,7 +698,7 @@ public class Ant extends Task { | |||
/** Creates a reference to be configured by Ant. */ | |||
public Reference() { | |||
super(); | |||
super(); | |||
} | |||
private String targetid = null; | |||
@@ -740,11 +736,12 @@ public class Ant extends Task { | |||
* Default constructor. | |||
*/ | |||
public TargetElement() { | |||
//default | |||
} | |||
/** | |||
* Set the name of this TargetElement. | |||
* @param name the <CODE>String</CODE> target name. | |||
* @param name the <code>String</code> target name. | |||
*/ | |||
public void setName(String name) { | |||
this.name = name; | |||
@@ -752,10 +749,10 @@ public class Ant extends Task { | |||
/** | |||
* Get the name of this TargetElement. | |||
* @return <CODE>String</CODE>. | |||
* @return <code>String</code>. | |||
*/ | |||
public String getName() { | |||
return name; | |||
} | |||
} | |||
} | |||
} |
@@ -61,6 +61,7 @@ public class Apt | |||
/** Constructor for Option */ | |||
public Option() { | |||
//default | |||
} | |||
/** | |||
@@ -121,8 +122,7 @@ public class Apt | |||
* @param compiler not used. | |||
*/ | |||
public void setCompiler(String compiler) { | |||
log(ERROR_IGNORING_COMPILER_OPTION, | |||
Project.MSG_WARN); | |||
log(ERROR_IGNORING_COMPILER_OPTION, Project.MSG_WARN); | |||
} | |||
/** | |||
@@ -187,9 +187,8 @@ public class CallTarget extends Task { | |||
throws IOException { | |||
if (callee != null) { | |||
return callee.handleInput(buffer, offset, length); | |||
} else { | |||
return super.handleInput(buffer, offset, length); | |||
} | |||
return super.handleInput(buffer, offset, length); | |||
} | |||
/** | |||
@@ -237,20 +237,20 @@ public class Concat extends Task { | |||
/** | |||
* Add a header to the concatenated output | |||
* @param header the header | |||
* @param headerToAdd the header | |||
* @since Ant 1.6 | |||
*/ | |||
public void addHeader(TextElement header) { | |||
this.header = header; | |||
public void addHeader(TextElement headerToAdd) { | |||
this.header = headerToAdd; | |||
} | |||
/** | |||
* Add a footer to the concatenated output | |||
* @param footer the footer | |||
* @param footerToAdd the footer | |||
* @since Ant 1.6 | |||
*/ | |||
public void addFooter(TextElement footer) { | |||
this.footer = footer; | |||
public void addFooter(TextElement footerToAdd) { | |||
this.footer = footerToAdd; | |||
} | |||
/** | |||
@@ -17,25 +17,30 @@ | |||
package org.apache.tools.ant.taskdefs; | |||
import java.io.OutputStream; | |||
import java.io.BufferedReader; | |||
import java.io.ByteArrayOutputStream; | |||
import java.io.File; | |||
import java.io.FileWriter; | |||
import java.io.IOException; | |||
import java.io.OutputStream; | |||
import java.io.PrintWriter; | |||
import java.io.StringReader; | |||
import java.lang.reflect.InvocationTargetException; | |||
import java.lang.reflect.Method; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.Iterator; | |||
import java.util.Map; | |||
import java.util.Set; | |||
import java.util.Vector; | |||
import org.apache.tools.ant.BuildException; | |||
import org.apache.tools.ant.Project; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.util.FileUtils; | |||
import org.apache.tools.ant.taskdefs.condition.Os; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.util.FileUtils; | |||
import org.apache.tools.ant.util.JavaEnvUtils; | |||
/** | |||
* Runs an external program. | |||
@@ -481,7 +486,8 @@ public class Execute { | |||
} | |||
return getExitValue(); | |||
} finally { | |||
// remove the process to the list of those to destroy if the VM exits | |||
// remove the process to the list of those to destroy if | |||
// the VM exits | |||
// | |||
processDestroyer.remove(process); | |||
} | |||
@@ -506,8 +512,8 @@ public class Execute { | |||
try { | |||
Thread.sleep(1000); | |||
} catch (InterruptedException e) { | |||
project.log("interruption in the sleep after having spawned a process", | |||
Project.MSG_VERBOSE); | |||
project.log("interruption in the sleep after having spawned a" | |||
+ " process", Project.MSG_VERBOSE); | |||
} | |||
} | |||
OutputStream dummyOut = new OutputStream() { | |||
@@ -521,7 +527,8 @@ public class Execute { | |||
handler.start(); | |||
process.getOutputStream().close(); | |||
project.log("spawned process " + process.toString(), Project.MSG_VERBOSE); | |||
project.log("spawned process " + process.toString(), | |||
Project.MSG_VERBOSE); | |||
} | |||
/** | |||
@@ -645,7 +652,7 @@ public class Execute { | |||
/** | |||
* Close the streams belonging to the given Process. | |||
* @param process the <CODE>Process</CODE>. | |||
* @param process the <code>Process</code>. | |||
*/ | |||
public static void closeStreams(Process process) { | |||
FileUtils.close(process.getInputStream()); | |||
@@ -717,7 +724,8 @@ public class Execute { | |||
* @param env The environment for the new process. If null, | |||
* the environment of the current process is used. | |||
* @return the created Process. | |||
* @throws IOException if attempting to run a command in a specific directory. | |||
* @throws IOException if attempting to run a command in a | |||
* specific directory. | |||
*/ | |||
public Process exec(Project project, String[] cmd, String[] env) | |||
throws IOException { | |||
@@ -771,7 +779,8 @@ public class Execute { | |||
* @param project the Ant project. | |||
* @param cmd the command line to execute as an array of strings. | |||
* @param env the environment to set as an array of strings. | |||
* @param workingDir the working directory where the command should run. | |||
* @param workingDir the working directory where the command | |||
* should run. | |||
* @return the created Process. | |||
* @throws IOException probably forwarded from Runtime#exec. | |||
*/ | |||
@@ -820,7 +829,8 @@ public class Execute { | |||
* @param cmd the command line to execute as an array of strings. | |||
* @param env the environment to set as an array of strings. | |||
* @return the created Process. | |||
* @throws IOException forwarded from the exec method of the command launcher. | |||
* @throws IOException forwarded from the exec method of the | |||
* command launcher. | |||
*/ | |||
public Process exec(Project project, String[] cmd, String[] env) | |||
throws IOException { | |||
@@ -849,7 +859,8 @@ public class Execute { | |||
* @param env the environment to set as an array of strings. | |||
* @param workingDir working directory where the command should run. | |||
* @return the created Process. | |||
* @throws IOException forwarded from the exec method of the command launcher. | |||
* @throws IOException forwarded from the exec method of the | |||
* command launcher. | |||
*/ | |||
public Process exec(Project project, String[] cmd, String[] env, | |||
File workingDir) throws IOException { | |||
@@ -897,7 +908,8 @@ public class Execute { | |||
* @param env the environment to set as an array of strings. | |||
* @param workingDir working directory where the command should run. | |||
* @return the created Process. | |||
* @throws IOException forwarded from the exec method of the command launcher. | |||
* @throws IOException forwarded from the exec method of the | |||
* command launcher. | |||
*/ | |||
public Process exec(Project project, String[] cmd, String[] env, | |||
File workingDir) throws IOException { | |||
@@ -942,7 +954,8 @@ public class Execute { | |||
* @param env the environment to set as an array of strings. | |||
* @param workingDir working directory where the command should run. | |||
* @return the created Process. | |||
* @throws IOException forwarded from the exec method of the command launcher. | |||
* @throws IOException forwarded from the exec method of the | |||
* command launcher. | |||
*/ | |||
public Process exec(Project project, String[] cmd, String[] env, | |||
File workingDir) throws IOException { | |||
@@ -976,7 +989,8 @@ public class Execute { | |||
* @param env the environment to set as an array of strings. | |||
* @param workingDir working directory where the command should run. | |||
* @return the created Process. | |||
* @throws IOException forwarded from the exec method of the command launcher. | |||
* @throws IOException forwarded from the exec method of the | |||
* command launcher. | |||
*/ | |||
public Process exec(Project project, String[] cmd, String[] env, | |||
File workingDir) throws IOException { | |||
@@ -993,7 +1007,8 @@ public class Execute { | |||
throw new IOException("Cannot locate antRun script: " | |||
+ "Property 'ant.home' not found"); | |||
} | |||
String antRun = project.resolveFile(antHome + File.separator + myScript).toString(); | |||
String antRun = project.resolveFile(antHome + File.separator | |||
+ myScript).toString(); | |||
// Build the command | |||
File commandDir = workingDir; | |||
@@ -1032,7 +1047,8 @@ public class Execute { | |||
* @param env the environment to set as an array of strings. | |||
* @param workingDir working directory where the command should run. | |||
* @return the created Process. | |||
* @throws IOException forwarded from the exec method of the command launcher. | |||
* @throws IOException forwarded from the exec method of the | |||
* command launcher. | |||
*/ | |||
public Process exec(Project project, String[] cmd, String[] env, | |||
File workingDir) throws IOException { | |||
@@ -1049,7 +1065,8 @@ public class Execute { | |||
throw new IOException("Cannot locate antRun script: " | |||
+ "Property 'ant.home' not found"); | |||
} | |||
String antRun = project.resolveFile(antHome + File.separator + myScript).toString(); | |||
String antRun = project.resolveFile(antHome + File.separator | |||
+ myScript).toString(); | |||
// Build the command | |||
File commandDir = workingDir; | |||
@@ -1083,7 +1100,8 @@ public class Execute { | |||
* @param cmd the command line to execute as an array of strings. | |||
* @param env the environment to set as an array of strings. | |||
* @return the created Process. | |||
* @throws IOException forwarded from the exec method of the command launcher. | |||
* @throws IOException forwarded from the exec method of the | |||
* command launcher. | |||
*/ | |||
public Process exec(Project project, String[] cmd, String[] env) | |||
throws IOException { | |||
@@ -1104,7 +1122,8 @@ public class Execute { | |||
* @param env the environment to set as an array of strings. | |||
* @param workingDir working directory where the command should run. | |||
* @return the created Process. | |||
* @throws IOException forwarded from the exec method of the command launcher. | |||
* @throws IOException forwarded from the exec method of the | |||
* command launcher. | |||
*/ | |||
public Process exec(Project project, String[] cmd, String[] env, | |||
File workingDir) throws IOException { | |||
@@ -1,5 +1,5 @@ | |||
/* | |||
* Copyright 2000-2004 The Apache Software Foundation | |||
* Copyright 2000-2005 The Apache Software Foundation | |||
* | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | |||
@@ -37,9 +37,9 @@ import org.apache.tools.ant.taskdefs.condition.ConditionBase; | |||
* are true. i.e. | |||
* <pre>fail := defined(ifProperty) && !defined(unlessProperty)</pre> | |||
* | |||
* A single nested<CODE><condition></CODE> element can be specified | |||
* instead of using <CODE>if</CODE>/<CODE>unless</CODE> (a combined | |||
* effect can be achieved using <CODE>isset</CODE> conditions). | |||
* A single nested<code><condition></code> element can be specified | |||
* instead of using <code>if</code>/<code>unless</code> (a combined | |||
* effect can be achieved using <code>isset</code> conditions). | |||
* | |||
* @since Ant 1.2 | |||
* | |||
@@ -90,17 +90,17 @@ public class Exit extends Task { | |||
/** | |||
* Set the status code to associate with the thrown Exception. | |||
* @param i the <CODE>int</CODE> status | |||
* @param i the <code>int</code> status | |||
*/ | |||
public void setStatus(int i) { | |||
status = new Integer(i); | |||
} | |||
/** | |||
* Throw a <CODE>BuildException</CODE> to exit (fail) the build. | |||
* Throw a <code>BuildException</code> to exit (fail) the build. | |||
* If specified, evaluate conditions: | |||
* A single nested condition is accepted, but requires that the | |||
* <CODE>if</CODE>/<code>unless</code> attributes be omitted. | |||
* <code>if</code>/<code>unless</code> attributes be omitted. | |||
* If the nested condition evaluates to true, or the | |||
* ifCondition is true or unlessCondition is false, the build will exit. | |||
* The error message is constructed from the text fields, from | |||
@@ -156,7 +156,7 @@ public class Exit extends Task { | |||
/** | |||
* Add a condition element. | |||
* @return <CODE>ConditionBase</CODE>. | |||
* @return <code>ConditionBase</code>. | |||
* @since Ant 1.6.2 | |||
*/ | |||
public ConditionBase createCondition() { | |||
@@ -207,10 +207,10 @@ public class Exit extends Task { | |||
/** | |||
* test whether there is a nested condition. | |||
* @return <CODE>boolean</CODE>. | |||
* @return <code>boolean</code>. | |||
*/ | |||
private boolean nestedConditionPresent() { | |||
return (nestedCondition != null); | |||
} | |||
} | |||
} |
@@ -48,21 +48,21 @@ import org.apache.tools.ant.util.JavaEnvUtils; | |||
* Generates Javadoc documentation for a collection | |||
* of source code. | |||
* | |||
* <P>Current known limitations are: | |||
* <p>Current known limitations are: | |||
* | |||
* <P><UL> | |||
* <LI>patterns must be of the form "xxx.*", every other pattern doesn't | |||
* <p><ul> | |||
* <li>patterns must be of the form "xxx.*", every other pattern doesn't | |||
* work. | |||
* <LI>there is no control on arguments sanity since they are left | |||
* <li>there is no control on arguments sanity since they are left | |||
* to the javadoc implementation. | |||
* <LI>argument J in javadoc1 is not supported (what is that for anyway?) | |||
* </UL> | |||
* <li>argument J in javadoc1 is not supported (what is that for anyway?) | |||
* </ul> | |||
* | |||
* <P>If no <CODE>doclet</CODE> is set, then the <CODE>version</CODE> and | |||
* <CODE>author</CODE> are by default <CODE>"yes"</CODE>. | |||
* <p>If no <code>doclet</code> is set, then the <code>version</code> and | |||
* <code>author</code> are by default <code>"yes"</code>. | |||
* | |||
* <P>Note: This task is run on another VM because the Javadoc code calls | |||
* <CODE>System.exit()</CODE> which would break Ant functionality. | |||
* <p>Note: This task is run on another VM because the Javadoc code calls | |||
* <code>System.exit()</code> which would break Ant functionality. | |||
* | |||
* @since Ant 1.1 | |||
* | |||
@@ -270,6 +270,7 @@ public class Javadoc extends Task { | |||
* Default constructor | |||
*/ | |||
public SourceFile() { | |||
//empty | |||
} | |||
/** | |||
@@ -1190,8 +1191,8 @@ public class Javadoc extends Task { | |||
} | |||
/** | |||
* Represents a link triplet (href, whether link is offline, location of the | |||
* package list if off line) | |||
* Represents a link triplet (href, whether link is offline, | |||
* location of the package list if off line) | |||
*/ | |||
public class LinkArgument { | |||
private String href; | |||
@@ -1199,6 +1200,7 @@ public class Javadoc extends Task { | |||
private File packagelistLoc; | |||
public LinkArgument() { | |||
//empty | |||
} | |||
public void setHref(String hr) { | |||
@@ -1269,6 +1271,7 @@ public class Javadoc extends Task { | |||
/** Sole constructor. */ | |||
public TagArgument () { | |||
//empty | |||
} | |||
/** | |||
@@ -1401,6 +1404,7 @@ public class Javadoc extends Task { | |||
private Vector packages = new Vector(); | |||
public GroupArgument() { | |||
//empty | |||
} | |||
public void setTitle(String src) { | |||
@@ -1705,9 +1709,11 @@ public class Javadoc extends Task { | |||
if (la.isLinkOffline()) { | |||
File packageListLocation = la.getPackagelistLoc(); | |||
if (packageListLocation == null) { | |||
throw new BuildException("The package list " | |||
+ " location for link " + la.getHref() | |||
+ " must be provided because the link is " | |||
throw new BuildException("The package list" | |||
+ " location for link " | |||
+ la.getHref() | |||
+ " must be provided " | |||
+ "because the link is " | |||
+ "offline"); | |||
} | |||
File packageListFile = | |||
@@ -1794,21 +1800,28 @@ public class Javadoc extends Task { | |||
// The tag element is not used as a fileset, | |||
// but specifies the tag directly. | |||
toExecute.createArgument().setValue ("-tag"); | |||
toExecute.createArgument().setValue (ta.getParameter()); | |||
toExecute.createArgument() | |||
.setValue (ta.getParameter()); | |||
} else { | |||
// The tag element is used as a fileset. Parse all the files and | |||
// create -tag arguments. | |||
DirectoryScanner tagDefScanner = ta.getDirectoryScanner(getProject()); | |||
// The tag element is used as a | |||
// fileset. Parse all the files and create | |||
// -tag arguments. | |||
DirectoryScanner tagDefScanner = | |||
ta.getDirectoryScanner(getProject()); | |||
String[] files = tagDefScanner.getIncludedFiles(); | |||
for (int i = 0; i < files.length; i++) { | |||
File tagDefFile = new File(tagDir, files[i]); | |||
try { | |||
BufferedReader in | |||
= new BufferedReader(new FileReader(tagDefFile)); | |||
= new BufferedReader( | |||
new FileReader(tagDefFile) | |||
); | |||
String line = null; | |||
while ((line = in.readLine()) != null) { | |||
toExecute.createArgument().setValue ("-tag"); | |||
toExecute.createArgument().setValue (line); | |||
toExecute.createArgument() | |||
.setValue("-tag"); | |||
toExecute.createArgument() | |||
.setValue(line); | |||
} | |||
in.close(); | |||
} catch (IOException ioe) { | |||
@@ -1870,8 +1883,8 @@ public class Javadoc extends Task { | |||
.setValue("@" + tmpList.getAbsolutePath()); | |||
} | |||
srcListWriter = new PrintWriter( | |||
new FileWriter(tmpList.getAbsolutePath(), | |||
true)); | |||
new FileWriter(tmpList.getAbsolutePath(), | |||
true)); | |||
} | |||
Enumeration e = packagesToDoc.elements(); | |||
@@ -1932,7 +1945,8 @@ public class Javadoc extends Task { | |||
exe.setCommandline(toExecute.getCommandline()); | |||
int ret = exe.execute(); | |||
if (ret != 0 && failOnError) { | |||
throw new BuildException("Javadoc returned " + ret, getLocation()); | |||
throw new BuildException("Javadoc returned " + ret, | |||
getLocation()); | |||
} | |||
} catch (IOException e) { | |||
throw new BuildException("Javadoc failed: " + e, e, getLocation()); | |||
@@ -2113,4 +2127,4 @@ public class Javadoc extends Task { | |||
return getProject().replaceProperties(content); | |||
} | |||
} | |||
} |
@@ -133,7 +133,7 @@ public class LoadProperties extends Task { | |||
} | |||
/** | |||
* get the classpath used by this <CODE>LoadProperties</CODE>. | |||
* get the classpath used by this <code>LoadProperties</code>. | |||
* @return The classpath | |||
*/ | |||
public Path getClasspath() { | |||
@@ -252,5 +252,4 @@ public class LoadProperties extends Task { | |||
filterChains.addElement(filter); | |||
} | |||
//end class | |||
} | |||
} |
@@ -1,5 +1,5 @@ | |||
/* | |||
* Copyright 2001-2004 The Apache Software Foundation | |||
* Copyright 2001-2005 The Apache Software Foundation | |||
* | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | |||
@@ -36,7 +36,6 @@ public class Http extends ProjectComponent implements Condition { | |||
/** | |||
* Set the url attribute | |||
* | |||
* @param url the url of the request | |||
*/ | |||
public void setUrl(String url) { | |||
@@ -47,7 +46,6 @@ public class Http extends ProjectComponent implements Condition { | |||
/** | |||
* Set the errorsBeginAt attribute | |||
* | |||
* @param errorsBeginAt number at which errors begin at, default is | |||
* 400 | |||
*/ | |||
@@ -75,9 +73,8 @@ public class Http extends ProjectComponent implements Condition { | |||
Project.MSG_VERBOSE); | |||
if (code > 0 && code < errorsBeginAt) { | |||
return true; | |||
} else { | |||
return false; | |||
} | |||
} | |||
return false; | |||
} | |||
} catch (java.io.IOException e) { | |||
return false; | |||
@@ -87,4 +84,4 @@ public class Http extends ProjectComponent implements Condition { | |||
} | |||
return true; | |||
} | |||
} | |||
} |
@@ -1,5 +1,5 @@ | |||
/* | |||
* Copyright 2004 The Apache Software Foundation | |||
* Copyright 2004-2005 The Apache Software Foundation | |||
* | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | |||
@@ -16,14 +16,15 @@ | |||
*/ | |||
package org.apache.tools.ant.taskdefs.condition; | |||
import org.apache.tools.ant.BuildException; | |||
import org.apache.tools.ant.Project; | |||
import org.apache.tools.ant.types.DataType; | |||
import java.io.File; | |||
import java.io.IOException; | |||
import java.util.Enumeration; | |||
import java.util.zip.ZipEntry; | |||
import java.util.zip.ZipFile; | |||
import java.util.Enumeration; | |||
import org.apache.tools.ant.BuildException; | |||
import org.apache.tools.ant.Project; | |||
import org.apache.tools.ant.types.DataType; | |||
/** | |||
* Checks whether a jarfile is signed: if the name of the | |||
@@ -37,12 +38,11 @@ public class IsSigned extends DataType implements Condition { | |||
private static final String SIG_END = ".SF"; | |||
private String name; | |||
private File file; | |||
private File file; | |||
/** | |||
* The jarfile that is to be tested for the presence | |||
* of a signature. | |||
* | |||
* @param file jarfile to be tested. | |||
*/ | |||
public void setFile(File file) { | |||
@@ -51,7 +51,6 @@ public class IsSigned extends DataType implements Condition { | |||
/** | |||
* The signature name to check jarfile for. | |||
* | |||
* @param name signature to look for. | |||
*/ | |||
public void setName(String name) { | |||
@@ -59,8 +58,8 @@ public class IsSigned extends DataType implements Condition { | |||
} | |||
/** | |||
* Returns <CODE>true</code> if the file exists and is signed with | |||
* the signature specified, or, if <CODE>name</code> wasn't | |||
* Returns <code>true</code> if the file exists and is signed with | |||
* the signature specified, or, if <code>name</code> wasn't | |||
* specified, if the file contains a signature. | |||
* @return true if the file is signed. | |||
*/ | |||
@@ -79,20 +78,19 @@ public class IsSigned extends DataType implements Condition { | |||
} | |||
} | |||
return false; | |||
} else { | |||
boolean shortSig = jarFile.getEntry(SIG_START | |||
+ name.toUpperCase() | |||
+ SIG_END) != null; | |||
boolean longSig = false; | |||
if (name.length() > 8) { | |||
longSig = | |||
} | |||
boolean shortSig = jarFile.getEntry(SIG_START | |||
+ name.toUpperCase() | |||
+ SIG_END) != null; | |||
boolean longSig = false; | |||
if (name.length() > 8) { | |||
longSig = | |||
jarFile.getEntry(SIG_START | |||
+ name.substring(0, 8).toUpperCase() | |||
+ SIG_END) != null; | |||
} | |||
return shortSig || longSig; | |||
+ name.substring(0, 8).toUpperCase() | |||
+ SIG_END) != null; | |||
} | |||
return shortSig || longSig; | |||
} finally { | |||
if (jarFile != null) { | |||
try { | |||
@@ -105,8 +103,8 @@ public class IsSigned extends DataType implements Condition { | |||
} | |||
/** | |||
* Returns <CODE>true</code> if the file exists and is signed with | |||
* the signature specified, or, if <CODE>name</code> wasn't | |||
* Returns <code>true</code> if the file exists and is signed with | |||
* the signature specified, or, if <code>name</code> wasn't | |||
* specified, if the file contains a signature. | |||
* @return true if the file is signed. | |||
*/ | |||
@@ -134,4 +132,4 @@ public class IsSigned extends DataType implements Condition { | |||
} | |||
return r; | |||
} | |||
} | |||
} |
@@ -18,6 +18,7 @@ | |||
package org.apache.tools.ant.taskdefs.condition; | |||
import java.util.Locale; | |||
import org.apache.tools.ant.BuildException; | |||
/** | |||
@@ -45,11 +46,11 @@ public class Os implements Condition { | |||
* | |||
*/ | |||
public Os() { | |||
//default | |||
} | |||
/** | |||
* Constructor that sets the family attribute | |||
* | |||
* @param family a String value | |||
*/ | |||
public Os(String family) { | |||
@@ -233,4 +234,4 @@ public class Os implements Condition { | |||
} | |||
return retValue; | |||
} | |||
} | |||
} |
@@ -16,16 +16,17 @@ | |||
*/ | |||
package org.apache.tools.ant.taskdefs.condition; | |||
import org.apache.tools.ant.ProjectComponent; | |||
import org.apache.tools.ant.BuildException; | |||
import org.apache.tools.ant.Project; | |||
import org.apache.tools.ant.ProjectComponent; | |||
import org.apache.tools.ant.util.JAXPUtils; | |||
import org.xml.sax.XMLReader; | |||
import org.xml.sax.SAXNotRecognizedException; | |||
import org.xml.sax.SAXNotSupportedException; | |||
import org.xml.sax.XMLReader; | |||
/** | |||
* test for the XML parser supporting a particular feature | |||
* Test for the XML parser supporting a particular feature | |||
* @since Ant 1.7 | |||
*/ | |||
public class ParserSupports extends ProjectComponent implements Condition { | |||
@@ -42,12 +43,13 @@ public class ParserSupports extends ProjectComponent implements Condition { | |||
" not recognized: "; | |||
private static final String NOT_SUPPORTED = | |||
" not supported: "; | |||
public static final String ERROR_NO_ATTRIBUTES = "Neither feature or property are set"; | |||
public static final String ERROR_NO_VALUE = "A value is needed when testing for property support"; | |||
public static final String ERROR_NO_ATTRIBUTES = | |||
"Neither feature or property are set"; | |||
public static final String ERROR_NO_VALUE = | |||
"A value is needed when testing for property support"; | |||
/** | |||
* Feature to probe for. | |||
* | |||
* @param feature | |||
*/ | |||
public void setFeature(String feature) { | |||
@@ -71,33 +73,30 @@ public class ParserSupports extends ProjectComponent implements Condition { | |||
this.value = value; | |||
} | |||
/** | |||
* validate the args, then try to set the feature or property | |||
* Validate the args, then try to set the feature or property | |||
* @return | |||
* @throws BuildException | |||
*/ | |||
public boolean eval() throws BuildException { | |||
if(feature!=null && property!=null) { | |||
if (feature != null && property != null) { | |||
throw new BuildException(ERROR_BOTH_ATTRIBUTES); | |||
} | |||
if(feature==null && property==null) { | |||
if (feature == null && property == null) { | |||
throw new BuildException(ERROR_NO_ATTRIBUTES); | |||
} | |||
//pick a value that is good for everything | |||
if(feature!=null) { | |||
if (feature != null) { | |||
return evalFeature(); | |||
} else { | |||
if(value==null) { | |||
throw new BuildException(ERROR_NO_VALUE); | |||
} | |||
return evalProperty(); | |||
} | |||
if (value == null) { | |||
throw new BuildException(ERROR_NO_VALUE); | |||
} | |||
return evalProperty(); | |||
} | |||
/** | |||
* get our reader | |||
* Get our reader | |||
* @return a reader | |||
*/ | |||
private XMLReader getReader() { | |||
@@ -106,7 +105,7 @@ public class ParserSupports extends ProjectComponent implements Condition { | |||
} | |||
/** | |||
* set a feature | |||
* Set a feature | |||
* @return true if the feature could be set | |||
*/ | |||
public boolean evalFeature() { | |||
@@ -116,7 +115,7 @@ public class ParserSupports extends ProjectComponent implements Condition { | |||
} | |||
boolean v= Project.toBoolean(value); | |||
try { | |||
reader.setFeature(feature,v); | |||
reader.setFeature(feature, v); | |||
} catch (SAXNotRecognizedException e) { | |||
log(FEATURE+NOT_RECOGNIZED+feature,Project.MSG_VERBOSE); | |||
return false; | |||
@@ -128,8 +127,7 @@ public class ParserSupports extends ProjectComponent implements Condition { | |||
} | |||
/** | |||
* set a feature | |||
* | |||
* Set a property | |||
* @return true if the feature could be set | |||
*/ | |||
public boolean evalProperty() { | |||
@@ -145,6 +143,4 @@ public class ParserSupports extends ProjectComponent implements Condition { | |||
} | |||
return true; | |||
} | |||
} | |||
} |
@@ -1,5 +1,5 @@ | |||
/* | |||
* Copyright 2003-2004 The Apache Software Foundation | |||
* Copyright 2003-2005 The Apache Software Foundation | |||
* | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | |||
@@ -41,12 +41,10 @@ public class EqualComparator implements Comparator { | |||
if (o1 == null) { | |||
if (o2 == null) { | |||
return 1; | |||
} else { | |||
return 0; | |||
} | |||
} else { | |||
return (o1.equals(o2)) ? 0 : 1; | |||
return 0; | |||
} | |||
return (o1.equals(o2)) ? 0 : 1; | |||
} | |||
/** | |||