Browse Source

More cleanup

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274776 13f79535-47bb-0310-9956-ffa450edef68
master
Conor MacNeill 22 years ago
parent
commit
e580392c2d
95 changed files with 1042 additions and 1028 deletions
  1. +17
    -15
      src/main/org/apache/tools/ant/AntClassLoader.java
  2. +20
    -20
      src/main/org/apache/tools/ant/BuildEvent.java
  3. +7
    -7
      src/main/org/apache/tools/ant/BuildListener.java
  4. +12
    -12
      src/main/org/apache/tools/ant/BuildLogger.java
  5. +2
    -2
      src/main/org/apache/tools/ant/ComponentHelper.java
  6. +37
    -30
      src/main/org/apache/tools/ant/DefaultLogger.java
  7. +3
    -3
      src/main/org/apache/tools/ant/DemuxInputStream.java
  8. +15
    -15
      src/main/org/apache/tools/ant/DemuxOutputStream.java
  9. +33
    -32
      src/main/org/apache/tools/ant/Diagnostics.java
  10. +12
    -12
      src/main/org/apache/tools/ant/DirectoryScanner.java
  11. +4
    -4
      src/main/org/apache/tools/ant/DynamicConfigurator.java
  12. +39
    -37
      src/main/org/apache/tools/ant/FileScanner.java
  13. +2
    -2
      src/main/org/apache/tools/ant/IntrospectionHelper.java
  14. +9
    -9
      src/main/org/apache/tools/ant/Location.java
  15. +6
    -6
      src/main/org/apache/tools/ant/Main.java
  16. +8
    -8
      src/main/org/apache/tools/ant/NoBannerLogger.java
  17. +21
    -21
      src/main/org/apache/tools/ant/PathTokenizer.java
  18. +2
    -2
      src/main/org/apache/tools/ant/ProjectComponent.java
  19. +9
    -9
      src/main/org/apache/tools/ant/RuntimeConfigurable.java
  20. +45
    -45
      src/main/org/apache/tools/ant/Target.java
  21. +5
    -5
      src/main/org/apache/tools/ant/Task.java
  22. +21
    -21
      src/main/org/apache/tools/ant/TaskAdapter.java
  23. +20
    -20
      src/main/org/apache/tools/ant/UnknownElement.java
  24. +2
    -2
      src/main/org/apache/tools/ant/XmlLogger.java
  25. +17
    -17
      src/main/org/apache/tools/ant/filters/BaseFilterReader.java
  26. +3
    -3
      src/main/org/apache/tools/ant/filters/BaseParamFilterReader.java
  27. +3
    -3
      src/main/org/apache/tools/ant/filters/ChainableReader.java
  28. +9
    -8
      src/main/org/apache/tools/ant/filters/ClassConstants.java
  29. +1
    -6
      src/main/org/apache/tools/ant/filters/EscapeUnicode.java
  30. +9
    -8
      src/main/org/apache/tools/ant/filters/ExpandProperties.java
  31. +10
    -5
      src/main/org/apache/tools/ant/filters/HeadFilter.java
  32. +16
    -16
      src/main/org/apache/tools/ant/filters/LineContainsRegExp.java
  33. +8
    -8
      src/main/org/apache/tools/ant/filters/PrefixLines.java
  34. +26
    -26
      src/main/org/apache/tools/ant/filters/ReplaceTokens.java
  35. +10
    -10
      src/main/org/apache/tools/ant/filters/StripLineBreaks.java
  36. +13
    -13
      src/main/org/apache/tools/ant/filters/StripLineComments.java
  37. +8
    -8
      src/main/org/apache/tools/ant/filters/TabsToSpaces.java
  38. +2
    -2
      src/main/org/apache/tools/ant/filters/TailFilter.java
  39. +13
    -13
      src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java
  40. +8
    -8
      src/main/org/apache/tools/ant/taskdefs/Ant.java
  41. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Basename.java
  42. +9
    -9
      src/main/org/apache/tools/ant/taskdefs/CallTarget.java
  43. +20
    -20
      src/main/org/apache/tools/ant/taskdefs/Concat.java
  44. +6
    -6
      src/main/org/apache/tools/ant/taskdefs/Copy.java
  45. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/Copydir.java
  46. +5
    -5
      src/main/org/apache/tools/ant/taskdefs/Copyfile.java
  47. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/Cvs.java
  48. +23
    -23
      src/main/org/apache/tools/ant/taskdefs/Delete.java
  49. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/Deltree.java
  50. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/Ear.java
  51. +5
    -5
      src/main/org/apache/tools/ant/taskdefs/Echo.java
  52. +6
    -6
      src/main/org/apache/tools/ant/taskdefs/Exec.java
  53. +15
    -15
      src/main/org/apache/tools/ant/taskdefs/ExecTask.java
  54. +34
    -34
      src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
  55. +11
    -11
      src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java
  56. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/FixCRLF.java
  57. +30
    -30
      src/main/org/apache/tools/ant/taskdefs/GenerateKey.java
  58. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Get.java
  59. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/ImportTask.java
  60. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/Input.java
  61. +9
    -9
      src/main/org/apache/tools/ant/taskdefs/Jar.java
  62. +29
    -29
      src/main/org/apache/tools/ant/taskdefs/Java.java
  63. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/Javadoc.java
  64. +6
    -6
      src/main/org/apache/tools/ant/taskdefs/Jikes.java
  65. +5
    -5
      src/main/org/apache/tools/ant/taskdefs/JikesOutputParser.java
  66. +10
    -10
      src/main/org/apache/tools/ant/taskdefs/KeySubst.java
  67. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/LoadFile.java
  68. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/LogOutputStream.java
  69. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/Manifest.java
  70. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/ManifestTask.java
  71. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/MatchingTask.java
  72. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/Mkdir.java
  73. +41
    -41
      src/main/org/apache/tools/ant/taskdefs/Parallel.java
  74. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/Patch.java
  75. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/PathConvert.java
  76. +22
    -22
      src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java
  77. +6
    -6
      src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java
  78. +40
    -40
      src/main/org/apache/tools/ant/taskdefs/Replace.java
  79. +69
    -69
      src/main/org/apache/tools/ant/taskdefs/SQLExec.java
  80. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/SendEmail.java
  81. +6
    -6
      src/main/org/apache/tools/ant/taskdefs/Sequential.java
  82. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/SignJar.java
  83. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/StreamPumper.java
  84. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Sync.java
  85. +10
    -10
      src/main/org/apache/tools/ant/taskdefs/Tar.java
  86. +11
    -11
      src/main/org/apache/tools/ant/taskdefs/Touch.java
  87. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Transform.java
  88. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/Typedef.java
  89. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Untar.java
  90. +9
    -9
      src/main/org/apache/tools/ant/taskdefs/UpToDate.java
  91. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/WaitFor.java
  92. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/War.java
  93. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
  94. +14
    -14
      src/main/org/apache/tools/ant/taskdefs/XmlProperty.java
  95. +30
    -30
      src/main/org/apache/tools/ant/taskdefs/Zip.java

+ 17
- 15
src/main/org/apache/tools/ant/AntClassLoader.java View File

@@ -155,8 +155,8 @@ public class AntClassLoader extends ClassLoader implements BuildListener {
*/
private void findNextResource() {
URL url = null;
while ((pathElementsIndex < pathComponents.size()) &&
(url == null)) {
while ((pathElementsIndex < pathComponents.size())
&& (url == null)) {
try {
File pathComponent
= (File) pathComponents.elementAt(pathElementsIndex);
@@ -266,7 +266,7 @@ public class AntClassLoader extends ClassLoader implements BuildListener {


/**
* Create an Ant Class Loader
* Create an Ant Class Loader
*/
public AntClassLoader() {
setParent(null);
@@ -353,7 +353,7 @@ public class AntClassLoader extends ClassLoader implements BuildListener {
}

/**
* Set the project associated with this class loader
* Set the project associated with this class loader
*
* @param project the project instance
*/
@@ -366,7 +366,7 @@ public class AntClassLoader extends ClassLoader implements BuildListener {

/**
* Set the classpath to search for classes to load. This should not be
* changed once the classloader starts to server classes
* changed once the classloader starts to server classes
*
* @param classpath the serahc classpath consisting of directories and
* jar/zip files.
@@ -403,7 +403,7 @@ public class AntClassLoader extends ClassLoader implements BuildListener {

/**
* Control whether class lookup is delegated to the parent loader first
* or after this loader. Use with extreme caution. Setting this to
* or after this loader. Use with extreme caution. Setting this to
* false violates the class loader hierarchy and can lead to Linkage errors
*
* @param parentFirst if true, delegate initial class search to the parent
@@ -483,7 +483,7 @@ public class AntClassLoader extends ClassLoader implements BuildListener {
throw new BuildException(e);
}
}
/**
* Add a file to the path
*
@@ -492,7 +492,7 @@ public class AntClassLoader extends ClassLoader implements BuildListener {
*
* @throws IOException if data needed from the file cannot be read.
*/
protected void addPathFile(File pathComponent) throws IOException {
protected void addPathFile(File pathComponent) throws IOException {
pathComponents.addElement(pathComponent);
}

@@ -986,11 +986,11 @@ public class AntClassLoader extends ClassLoader implements BuildListener {
if (isParentFirst(classname)) {
try {
theClass = findBaseClass(classname);
log("Class " + classname + " loaded from parent loader "
log("Class " + classname + " loaded from parent loader "
+ "(parentFirst)", Project.MSG_DEBUG);
} catch (ClassNotFoundException cnfe) {
theClass = findClass(classname);
log("Class " + classname + " loaded from ant loader "
log("Class " + classname + " loaded from ant loader "
+ "(parentFirst)", Project.MSG_DEBUG);
}
} else {
@@ -1073,7 +1073,7 @@ public class AntClassLoader extends ClassLoader implements BuildListener {
return defineClass(classname, classData, 0, classData.length);
}
}
/**
* Reads a class definition from a stream.
*
@@ -1122,7 +1122,7 @@ public class AntClassLoader extends ClassLoader implements BuildListener {
return findClassInComponents(name);
}

/**
/**
* Indicate if the given file is in this loader's path
*
* @param component the file which is to be checked
@@ -1138,7 +1138,7 @@ public class AntClassLoader extends ClassLoader implements BuildListener {
}
return false;
}

/**
* Finds a class on the given classpath.
@@ -1164,7 +1164,7 @@ public class AntClassLoader extends ClassLoader implements BuildListener {
try {
stream = getResourceStream(pathComponent, classFilename);
if (stream != null) {
log("Loaded from " + pathComponent + " "
log("Loaded from " + pathComponent + " "
+ classFilename, Project.MSG_DEBUG);
return getClassFromStream(stream, name, pathComponent);
}
@@ -1184,7 +1184,9 @@ public class AntClassLoader extends ClassLoader implements BuildListener {
if (stream != null) {
stream.close();
}
} catch (IOException e) {}
} catch (IOException e) {
//ignore
}
}
}



+ 20
- 20
src/main/org/apache/tools/ant/BuildEvent.java View File

@@ -65,14 +65,14 @@ import java.util.EventObject;
* @author Matt Foemmel
*/
public class BuildEvent extends EventObject {
/** Project which emitted the event. */
private Project project;
/** Target which emitted the event, if specified. */
private Target target;
/** Task which emitted the event, if specified. */
private Task task;
/**
/**
* Message associated with the event. This is only used for
* "messageLogged" events.
*/
@@ -83,7 +83,7 @@ public class BuildEvent extends EventObject {
private int priority = Project.MSG_VERBOSE;
/**
* The exception associated with this event, if any.
* This is only used for "taskFinished", "targetFinished",
* This is only used for "taskFinished", "targetFinished",
* and "buildFinished" events.
*/
private Throwable exception;
@@ -100,7 +100,7 @@ public class BuildEvent extends EventObject {
this.target = null;
this.task = null;
}
/**
* Construct a BuildEvent for a target level event.
* The project associated with the event is derived
@@ -115,10 +115,10 @@ public class BuildEvent extends EventObject {
this.target = target;
this.task = null;
}
/**
* Construct a BuildEvent for a task level event.
* The project and target associated with the event
* The project and target associated with the event
* are derived from the given task.
*
* @param task the task that emitted the event.
@@ -134,7 +134,7 @@ public class BuildEvent extends EventObject {
/**
* Sets the message and priority associated with this event.
* This is used for "messageLogged" events.
*
*
* @param message the message to be associated with this event.
* Should not be <code>null</code>.
* @param priority the priority to be associated with this event,
@@ -146,12 +146,12 @@ public class BuildEvent extends EventObject {
this.message = message;
this.priority = priority;
}
/**
* Sets the exception associated with this event. This is used
* for "taskFinished", "targetFinished", and "buildFinished"
* Sets the exception associated with this event. This is used
* for "taskFinished", "targetFinished", and "buildFinished"
* events.
*
*
* @param exception The exception to be associated with this event.
* May be <code>null</code>.
*
@@ -165,7 +165,7 @@ public class BuildEvent extends EventObject {

/**
* Returns the project that fired this event.
*
*
* @return the project that fired this event
*/
public Project getProject() {
@@ -174,18 +174,18 @@ public class BuildEvent extends EventObject {

/**
* Returns the target that fired this event.
*
*
* @return the project that fired this event, or <code>null</code>
* if this event is a project level event.
*/
public Target getTarget() {
return target;
}

/**
* Returns the task that fired this event.
*
*
* @return the task that fired this event, or <code>null</code>
* if this event is a project or target level event.
*/
@@ -199,7 +199,7 @@ public class BuildEvent extends EventObject {
*
* @return the message associated with this event, or <code>null</code>
* if no message has been set.
*
*
* @see BuildListener#messageLogged(BuildEvent)
*/
public String getMessage() {
@@ -210,12 +210,12 @@ public class BuildEvent extends EventObject {
* Returns the priority of the logging message. This field will only
* be set for "messageLogged" events. The meaning of this priority
* is as specified by the constants in the {@link Project Project} class.
*
*
* @return the priority associated with this event.
*
* @see BuildListener#messageLogged(BuildEvent)
*/
public int getPriority(){
public int getPriority() {
return priority;
}

@@ -223,8 +223,8 @@ public class BuildEvent extends EventObject {
* Returns the exception that was thrown, if any. This field will only
* be set for "taskFinished", "targetFinished", and "buildFinished"
* events.
*
* @return the exception associated with this exception, or
*
* @return the exception associated with this exception, or
* <code>null</code> if no exception has been set.
*
* @see BuildListener#taskFinished(BuildEvent)


+ 7
- 7
src/main/org/apache/tools/ant/BuildListener.java View File

@@ -57,7 +57,7 @@ package org.apache.tools.ant;
import java.util.EventListener;

/**
* Instances of classes that implement this interface can register
* Instances of classes that implement this interface can register
* to be notified when things happened during a build.
*
* @see BuildEvent
@@ -70,7 +70,7 @@ public interface BuildListener extends EventListener {
/**
* Signals that a build has started. This event
* is fired before any targets have started.
*
*
* @param event An event with any relevant extra information.
* Must not be <code>null</code>.
*/
@@ -79,7 +79,7 @@ public interface BuildListener extends EventListener {
/**
* Signals that the last target has finished. This event
* will still be fired if an error occurred during the build.
*
*
* @param event An event with any relevant extra information.
* Must not be <code>null</code>.
*
@@ -89,7 +89,7 @@ public interface BuildListener extends EventListener {

/**
* Signals that a target is starting.
*
*
* @param event An event with any relevant extra information.
* Must not be <code>null</code>.
*
@@ -100,7 +100,7 @@ public interface BuildListener extends EventListener {
/**
* Signals that a target has finished. This event will
* still be fired if an error occurred during the build.
*
*
* @param event An event with any relevant extra information.
* Must not be <code>null</code>.
*
@@ -110,7 +110,7 @@ public interface BuildListener extends EventListener {

/**
* Signals that a task is starting.
*
*
* @param event An event with any relevant extra information.
* Must not be <code>null</code>.
*
@@ -131,7 +131,7 @@ public interface BuildListener extends EventListener {

/**
* Signals a message logging event.
*
*
* @param event An event with any relevant extra information.
* Must not be <code>null</code>.
*


+ 12
- 12
src/main/org/apache/tools/ant/BuildLogger.java View File

@@ -57,32 +57,32 @@ package org.apache.tools.ant;
import java.io.PrintStream;

/**
* Interface used by Ant to log the build output.
* Interface used by Ant to log the build output.
*
* A build logger is a build listener which has the 'right' to send output to
* the ant log, which is usually <code>System.out</code> unless redirected by
* A build logger is a build listener which has the 'right' to send output to
* the ant log, which is usually <code>System.out</code> unless redirected by
* the <code>-logfile</code> option.
*
* @author Conor MacNeill
*/
public interface BuildLogger extends BuildListener {
/**
* Sets the highest level of message this logger should respond to.
*
* Only messages with a message level lower than or equal to the
* Only messages with a message level lower than or equal to the
* given level should be written to the log.
* <P>
* Constants for the message levels are in the
* {@link Project Project} class. The order of the levels, from least
* to most verbose, is <code>MSG_ERR</code>, <code>MSG_WARN</code>,
* <code>MSG_INFO</code>, <code>MSG_VERBOSE</code>,
* Constants for the message levels are in the
* {@link Project Project} class. The order of the levels, from least
* to most verbose, is <code>MSG_ERR</code>, <code>MSG_WARN</code>,
* <code>MSG_INFO</code>, <code>MSG_VERBOSE</code>,
* <code>MSG_DEBUG</code>.
*
* @param level the logging level for the logger.
*/
void setMessageOutputLevel(int level);
/**
* Sets the output stream to which this logger is to send its output.
*
@@ -90,7 +90,7 @@ public interface BuildLogger extends BuildListener {
* Must not be <code>null</code>.
*/
void setOutputPrintStream(PrintStream output);
/**
* Sets this logger to produce emacs (and other editor) friendly output.
*
@@ -105,5 +105,5 @@ public interface BuildLogger extends BuildListener {
* @param err The error stream for the logger.
* Must not be <code>null</code>.
*/
void setErrorPrintStream(PrintStream err);
void setErrorPrintStream(PrintStream err);
}

+ 2
- 2
src/main/org/apache/tools/ant/ComponentHelper.java View File

@@ -105,8 +105,8 @@ public class ComponentHelper {
*/
private Hashtable createdTasks = new Hashtable();

protected ComponentHelper next;
protected Project project;
private ComponentHelper next;
private Project project;

/**
* find a project component for a specific project, creating


+ 37
- 30
src/main/org/apache/tools/ant/DefaultLogger.java View File

@@ -69,7 +69,7 @@ import org.apache.tools.ant.util.StringUtils;
* @author Matt Foemmel
*/
public class DefaultLogger implements BuildLogger {
/**
/**
* Size of left-hand column for right-justified task name.
* @see #messageLogged(BuildEvent)
*/
@@ -77,16 +77,19 @@ public class DefaultLogger implements BuildLogger {

/** PrintStream to write non-error messages to */
protected PrintStream out;

/** PrintStream to write error messages to */
protected PrintStream err;

/** Lowest level of message to write out */
protected int msgOutputLevel = Project.MSG_ERR;

/** Time of the start of the build */
private long startTime = System.currentTimeMillis();

/** Line separator */
protected static final String lSep = StringUtils.LINE_SEP;
/** Whether or not to use emacs-style output */
protected boolean emacsMode = false;

@@ -99,17 +102,17 @@ public class DefaultLogger implements BuildLogger {
/**
* Sets the highest level of message this logger should respond to.
*
* Only messages with a message level lower than or equal to the
* Only messages with a message level lower than or equal to the
* given level should be written to the log.
* <P>
* Constants for the message levels are in the
* {@link Project Project} class. The order of the levels, from least
* to most verbose, is <code>MSG_ERR</code>, <code>MSG_WARN</code>,
* <code>MSG_INFO</code>, <code>MSG_VERBOSE</code>,
* Constants for the message levels are in the
* {@link Project Project} class. The order of the levels, from least
* to most verbose, is <code>MSG_ERR</code>, <code>MSG_WARN</code>,
* <code>MSG_INFO</code>, <code>MSG_VERBOSE</code>,
* <code>MSG_DEBUG</code>.
* <P>
* The default message level for DefaultLogger is Project.MSG_ERR.
*
*
* @param level the logging level for the logger.
*/
public void setMessageOutputLevel(int level) {
@@ -148,7 +151,7 @@ public class DefaultLogger implements BuildLogger {

/**
* Responds to a build being started by just remembering the current time.
*
*
* @param event Ignored.
*/
public void buildStarted(BuildEvent event) {
@@ -159,7 +162,7 @@ public class DefaultLogger implements BuildLogger {
* Prints whether the build succeeded or failed,
* any errors the occured during the build, and
* how long the build took.
*
*
* @param event An event with any relevant extra information.
* Must not be <code>null</code>.
*/
@@ -175,8 +178,8 @@ public class DefaultLogger implements BuildLogger {
message.append("BUILD FAILED");
message.append(StringUtils.LINE_SEP);

if (Project.MSG_VERBOSE <= msgOutputLevel ||
!(error instanceof BuildException)) {
if (Project.MSG_VERBOSE <= msgOutputLevel
|| !(error instanceof BuildException)) {
message.append(StringUtils.getStackTrace(error));
} else {
if (error instanceof BuildException) {
@@ -202,14 +205,14 @@ public class DefaultLogger implements BuildLogger {
/**
* Logs a message to say that the target has started if this
* logger allows information-level messages.
*
*
* @param event An event with any relevant extra information.
* Must not be <code>null</code>.
*/
public void targetStarted(BuildEvent event) {
if (Project.MSG_INFO <= msgOutputLevel
&& !event.getTarget().getName().equals("")) {
String msg = StringUtils.LINE_SEP
String msg = StringUtils.LINE_SEP
+ event.getTarget().getName() + ":";
printMessage(msg, out, event.getPriority());
log(msg);
@@ -218,30 +221,33 @@ public class DefaultLogger implements BuildLogger {

/**
* No-op implementation.
*
*
* @param event Ignored.
*/
public void targetFinished(BuildEvent event) {}
public void targetFinished(BuildEvent event) {
}

/**
* No-op implementation.
*
*
* @param event Ignored.
*/
public void taskStarted(BuildEvent event) {}
public void taskStarted(BuildEvent event) {
}

/**
* No-op implementation.
*
*
* @param event Ignored.
*/
public void taskFinished(BuildEvent event) {}
public void taskFinished(BuildEvent event) {
}

/**
* Logs a message, if the priority is suitable.
* In non-emacs mode, task level messages are prefixed by the
* task name which is right-justified.
*
*
* @param event A BuildEvent containing message information.
* Must not be <code>null</code>.
*/
@@ -264,7 +270,7 @@ public class DefaultLogger implements BuildLogger {
label = tmp.toString();

try {
BufferedReader r =
BufferedReader r =
new BufferedReader(
new StringReader(event.getMessage()));
String line = r.readLine();
@@ -297,9 +303,9 @@ public class DefaultLogger implements BuildLogger {

/**
* Convenience method to format a specified length of time.
*
*
* @param millis Length of time to format, in milliseonds.
*
*
* @return the time as a formatted string.
*
* @see DateUtils#formatElapsedTime(long)
@@ -310,12 +316,12 @@ public class DefaultLogger implements BuildLogger {

/**
* Prints a message to a PrintStream.
*
* @param message The message to print.
*
* @param message The message to print.
* Should not be <code>null</code>.
* @param stream A PrintStream to print the message to.
* @param stream A PrintStream to print the message to.
* Must not be <code>null</code>.
* @param priority The priority of the message.
* @param priority The priority of the message.
* (Ignored in this implementation.)
*/
protected void printMessage(final String message,
@@ -327,8 +333,9 @@ public class DefaultLogger implements BuildLogger {
/**
* Empty implementation which allows subclasses to receive the
* same output that is generated here.
*
*
* @param message Message being logged. Should not be <code>null</code>.
*/
protected void log(String message) {}
protected void log(String message) {
}
}

+ 3
- 3
src/main/org/apache/tools/ant/DemuxInputStream.java View File

@@ -59,7 +59,7 @@ import java.io.InputStream;

/**
*
* Passes input requests tot he project objetc for demuxing into
* Passes input requests tot he project objetc for demuxing into
* individual tasks and threads.
*
* @since Ant 1.6
@@ -71,7 +71,7 @@ public class DemuxInputStream extends InputStream {
* The project to from which to get input.
*/
private Project project;
/**
* Create a DemuxInputStream for the given project
*
@@ -91,7 +91,7 @@ public class DemuxInputStream extends InputStream {
}
return buffer[0];
}

/**
* @see InputStream.read(byte[], int, int)


+ 15
- 15
src/main/org/apache/tools/ant/DemuxOutputStream.java View File

@@ -78,18 +78,18 @@ public class DemuxOutputStream extends OutputStream {
* The per-thread output stream.
*/
private ByteArrayOutputStream buffer;
/**
/**
* Whether or not the next line-terminator should be skipped in terms
* of processing the buffer. Used to avoid \r\n invoking
* processBuffer twice.
*/
private boolean skip = false;
}
/** Maximum buffer size. */
private static final int MAX_SIZE = 1024;
/** Mapping from thread to buffer (Thread to BufferInfo). */
private Hashtable buffers = new Hashtable();

@@ -102,14 +102,14 @@ public class DemuxOutputStream extends OutputStream {
* Whether or not this stream represents an error stream.
*/
private boolean isErrorStream;
/**
* Creates a new instance of this class.
*
* @param project The project instance for which output is being
* @param project The project instance for which output is being
* demultiplexed. Must not be <code>null</code>.
* @param isErrorStream <code>true</code> if this is the error string,
* otherwise a normal output stream. This is
* @param isErrorStream <code>true</code> if this is the error string,
* otherwise a normal output stream. This is
* passed to the project so it knows
* which stream it is receiving.
*/
@@ -120,7 +120,7 @@ public class DemuxOutputStream extends OutputStream {

/**
* Returns the buffer associated with the current thread.
*
*
* @return a BufferInfo for the current thread to write data to
*/
private BufferInfo getBufferInfo() {
@@ -138,7 +138,7 @@ public class DemuxOutputStream extends OutputStream {
/**
* Resets the buffer for the current thread.
*/
private void resetBufferInfo() {
private void resetBufferInfo() {
Thread current = Thread.currentThread();
BufferInfo bufferInfo = (BufferInfo) buffers.get(current);
try {
@@ -149,11 +149,11 @@ public class DemuxOutputStream extends OutputStream {
bufferInfo.buffer = new ByteArrayOutputStream();
bufferInfo.skip = false;
}
/**
* Removes the buffer for the current thread.
*/
private void removeBuffer() {
private void removeBuffer() {
Thread current = Thread.currentThread();
buffers.remove (current);
}
@@ -187,7 +187,7 @@ public class DemuxOutputStream extends OutputStream {
*
* @param buffer the ByteArrayOutputStream used to collect the output
* until a line separator is seen.
*
*
* @see Project#demuxOutput(String,boolean)
*/
protected void processBuffer(ByteArrayOutputStream buffer) {
@@ -201,7 +201,7 @@ public class DemuxOutputStream extends OutputStream {
*
* @param buffer the ByteArrayOutputStream used to collect the output
* until a line separator is seen.
*
*
* @see Project#demuxOutput(String,boolean)
*/
protected void processFlush(ByteArrayOutputStream buffer) {
@@ -214,7 +214,7 @@ public class DemuxOutputStream extends OutputStream {
* Equivalent to flushing the stream.
*
* @exception IOException if there is a problem closing the stream.
*
*
* @see #flush
*/
public void close() throws IOException {


+ 33
- 32
src/main/org/apache/tools/ant/Diagnostics.java View File

@@ -77,11 +77,11 @@ import java.lang.reflect.InvocationTargetException;
*/
public final class Diagnostics {

private static final String TEST_CLASS
private static final String TEST_CLASS
= "org.apache.tools.ant.taskdefs.optional.Test";
/** utility class */
private Diagnostics(){
private Diagnostics() {
}

/**
@@ -92,7 +92,7 @@ public final class Diagnostics {
public static boolean isOptionalAvailable() {
try {
Class.forName(TEST_CLASS);
} catch (ClassNotFoundException e){
} catch (ClassNotFoundException e) {
return false;
}
return true;
@@ -105,19 +105,19 @@ public final class Diagnostics {
*/
public static void validateVersion() throws BuildException {
try {
Class optional
Class optional
= Class.forName("org.apache.tools.ant.taskdefs.optional.Test");
String coreVersion = getImplementationVersion(Main.class);
String optionalVersion = getImplementationVersion(optional);
if (coreVersion != null && !coreVersion.equals(optionalVersion)) {
throw new BuildException(
"Invalid implementation version between Ant core and "
+ "Ant optional tasks.\n" +
" core : " + coreVersion + "\n" +
" optional: " + optionalVersion);
throw new BuildException("Invalid implementation version "
+ "between Ant core and Ant optional tasks.\n"
+ " core : " + coreVersion + "\n"
+ " optional: " + optionalVersion);
}
} catch (ClassNotFoundException e){
} catch (ClassNotFoundException e) {
// ignore
}
}

@@ -144,7 +144,7 @@ public final class Diagnostics {
return null;
}
File[] files = new File[filenames.length];
for (int i = 0; i < filenames.length; i++){
for (int i = 0; i < filenames.length; i++) {
files[i] = new File(libDir, filenames[i]);
}
return files;
@@ -154,7 +154,7 @@ public final class Diagnostics {
* main entry point for command line
* @param args command line arguments.
*/
public static void main(String[] args){
public static void main(String[] args) {
doReport(System.out);
}

@@ -165,18 +165,18 @@ public final class Diagnostics {
* @return null if there is no package or implementation version.
* '?.?' for JDK 1.0 or 1.1.
*/
private static String getImplementationVersion(Class clazz){
private static String getImplementationVersion(Class clazz) {
try {
// Package pkg = clazz.getPackage();
// Package pkg = clazz.getPackage();
Method method = Class.class.getMethod("getPackage", new Class[0]);
Object pkg = method.invoke(clazz, null);
if (pkg != null) {
// pkg.getImplementationVersion();
method = pkg.getClass().getMethod("getImplementationVersion", new Class[0]);
Object version = method.invoke(pkg, null);
Object version = method.invoke(pkg, null);
return (String) version;
}
} catch (Exception e){
} catch (Exception e) {
// JDK < 1.2 should land here because the methods above don't exist.
return "?.?";
}
@@ -211,6 +211,7 @@ public final class Diagnostics {
try {
saxParser = saxParserFactory.newSAXParser();
} catch (Exception e) {
// ignore
}
return saxParser;
}
@@ -245,7 +246,7 @@ public final class Diagnostics {
* Print a report to the given stream.
* @param out the stream to print the report to.
*/
public static void doReport(PrintStream out){
public static void doReport(PrintStream out) {
out.println("------- Ant diagnostics report -------");
out.println(Main.getAntVersion());
out.println();
@@ -258,9 +259,9 @@ public final class Diagnostics {
try {
optional = Class.forName(
"org.apache.tools.ant.taskdefs.optional.Test");
out.println("optional tasks : "
out.println("optional tasks : "
+ getImplementationVersion(optional));
} catch (ClassNotFoundException e){
} catch (ClassNotFoundException e) {
out.println("optional tasks : not available");
}

@@ -302,7 +303,7 @@ public final class Diagnostics {
* Report a listing of system properties existing in the current vm.
* @param out the stream to print the properties to.
*/
private static void doReportSystemProperties(PrintStream out){
private static void doReportSystemProperties(PrintStream out) {
for (Enumeration keys = System.getProperties().keys();
keys.hasMoreElements();) {
String key = (String) keys.nextElement();
@@ -315,14 +316,14 @@ public final class Diagnostics {
* Report the content of ANT_HOME/lib directory
* @param out the stream to print the content to
*/
private static void doReportLibraries(PrintStream out){
private static void doReportLibraries(PrintStream out) {
out.println("ant.home: " + System.getProperty("ant.home"));
File[] libs = listLibraries();
if (libs == null) {
out.println("Unable to list libraries.");
return;
}
for (int i = 0; i < libs.length; i++){
for (int i = 0; i < libs.length; i++) {
out.println(libs[i].getName()
+ " (" + libs[i].length() + " bytes)");
}
@@ -333,12 +334,12 @@ public final class Diagnostics {
* Call org.apache.env.Which if available
* @param out the stream to print the content to.
*/
private static void doReportWhich(PrintStream out){
private static void doReportWhich(PrintStream out) {
Throwable error = null;
try {
Class which = Class.forName("org.apache.env.Which");
Method method
= which.getMethod("main", new Class[]{ String[].class });
Method method
= which.getMethod("main", new Class[]{String[].class});
method.invoke(null, new Object[]{new String[]{}});
} catch (ClassNotFoundException e) {
out.println("Not available.");
@@ -363,7 +364,7 @@ public final class Diagnostics {
* @param out the stream to print the tasks report to
* <tt>null</tt> for a missing stream (ie mapping).
*/
private static void doReportTasksAvailability(PrintStream out){
private static void doReportTasksAvailability(PrintStream out) {
InputStream is = Main.class.getResourceAsStream(
"/org/apache/tools/ant/taskdefs/defaults.properties");
if (is == null) {
@@ -372,13 +373,13 @@ public final class Diagnostics {
Properties props = new Properties();
try {
props.load(is);
for (Enumeration keys = props.keys(); keys.hasMoreElements();){
for (Enumeration keys = props.keys(); keys.hasMoreElements();) {
String key = (String) keys.nextElement();
String classname = props.getProperty(key);
try {
Class.forName(classname);
props.remove(key);
} catch (ClassNotFoundException e){
} catch (ClassNotFoundException e) {
out.println(key + " : Not Available");
} catch (NoClassDefFoundError e) {
String pkg = e.getMessage().replace('/', '.');
@@ -387,10 +388,10 @@ public final class Diagnostics {
out.println(key + " : Initialization error");
}
}
if (props.size() == 0){
if (props.size() == 0) {
out.println("All defined tasks are available");
}
} catch (IOException e){
} catch (IOException e) {
out.println(e.getMessage());
}
}


+ 12
- 12
src/main/org/apache/tools/ant/DirectoryScanner.java View File

@@ -152,7 +152,7 @@ import org.apache.tools.ant.util.FileUtils;
* @author <a href="mailto:bruce@callenish.com">Bruce Atherton</a>
* @author <a href="mailto:levylambert@tiscali-dsl.de">Antoine Levy-Lambert</a>
*/
public class DirectoryScanner
public class DirectoryScanner
implements FileScanner, SelectorScanner, ResourceFactory {


@@ -174,7 +174,7 @@ public class DirectoryScanner
"**/.#*",
"**/%*%",
"**/._*",
// CVS
"**/CVS",
"**/CVS/**",
@@ -200,7 +200,7 @@ public class DirectoryScanner
*
* @see #addDefaultExcludes()
*/
private static Vector defaultExcludes = new Vector();
private static Vector defaultExcludes = new Vector();

static {
for (int i = 0; i < DEFAULTEXCLUDES.length; i++) {
@@ -405,8 +405,8 @@ public class DirectoryScanner
/**
* Get the list of patterns that should be excluded by default.
*
* @return An array of <code>String</code> based on the current
* contents of the <code>defaultExcludes</code>
* @return An array of <code>String</code> based on the current
* contents of the <code>defaultExcludes</code>
* <code>Vector</code>.
*
* @since Ant 1.6
@@ -417,17 +417,17 @@ public class DirectoryScanner
}

/**
* Add a pattern to the default excludes unless it is already a
* Add a pattern to the default excludes unless it is already a
* default exclude.
*
* @param s A string to add as an exclude pattern.
* @return <code>true</code> if the string was added
* @return <code>true</code> if the string was added
* <code>false</code> if it already
* existed.
*
* @since Ant 1.6
*/
public static boolean addDefaultExclude(String s){
public static boolean addDefaultExclude(String s) {
if (defaultExcludes.indexOf(s) == -1) {
defaultExcludes.add(s);
return true;
@@ -439,7 +439,7 @@ public class DirectoryScanner
* Remove a string if it is a default exclude.
*
* @param s The string to attempt to remove.
* @return <code>true</code> if <code>s</code> was a default
* @return <code>true</code> if <code>s</code> was a default
* exclude (and thus was removed),
* <code>false</code> if <code>s</code> was not
* in the default excludes list to begin with
@@ -859,7 +859,7 @@ public class DirectoryScanner
protected boolean isSelected(String name, File file) {
if (selectors != null) {
for (int i = 0; i < selectors.length; i++) {
if ((selectors[i].isSelected(basedir, name, file)) == false) {
if (!selectors[i].isSelected(basedir, name, file)) {
return false;
}
}
@@ -1013,7 +1013,7 @@ public class DirectoryScanner
}
String[] defaultExcludesTemp = getDefaultExcludes();
for (int i = 0; i < defaultExcludesTemp.length; i++) {
newExcludes[i + excludesLength] =
newExcludes[i + excludesLength] =
defaultExcludesTemp[i].replace('/', File.separatorChar)
.replace('\\', File.separatorChar);
}
@@ -1029,7 +1029,7 @@ public class DirectoryScanner
*/
public Resource getResource(String name) {
File f = fileUtils.resolveFile(basedir, name);
return new Resource(name, f.exists(), f.lastModified(),
return new Resource(name, f.exists(), f.lastModified(),
f.isDirectory());
}



+ 4
- 4
src/main/org/apache/tools/ant/DynamicConfigurator.java View File

@@ -61,14 +61,14 @@ package org.apache.tools.ant;
* @since Ant 1.5
*/
public interface DynamicConfigurator {
/**
* Set a named attribute to the given value
*
*
* @param name the name of the attribute
* @param value the new value of the attribute
* @throws BuildException when any error occurs
*/
*/
void setDynamicAttribute(String name, String value)
throws BuildException;

@@ -78,6 +78,6 @@ public interface DynamicConfigurator {
* @param name the element nbame
* @throws BuildException when any error occurs
* @return the element created
*/
*/
Object createDynamicElement(String name) throws BuildException;
}

+ 39
- 37
src/main/org/apache/tools/ant/FileScanner.java View File

@@ -56,46 +56,48 @@ package org.apache.tools.ant;
import java.io.File;

/**
* An interface used to describe the actions required of any type of
* An interface used to describe the actions required of any type of
* directory scanner.
*
* @author Apache Ant
*/
public interface FileScanner {
/**
* Adds default exclusions to the current exclusions set.
*/
void addDefaultExcludes();
/**
* Returns the base directory to be scanned.
* Returns the base directory to be scanned.
* This is the directory which is scanned recursively.
*
* @return the base directory to be scanned
*/
File getBasedir();
/**
* Returns the names of the directories which matched at least one of the
* Returns the names of the directories which matched at least one of the
* include patterns and at least one of the exclude patterns.
* The names are relative to the base directory.
*
* @return the names of the directories which matched at least one of the
*
* @return the names of the directories which matched at least one of the
* include patterns and at least one of the exclude patterns.
*/
String[] getExcludedDirectories();
/**
* Returns the names of the files which matched at least one of the
* Returns the names of the files which matched at least one of the
* include patterns and at least one of the exclude patterns.
* The names are relative to the base directory.
*
* @return the names of the files which matched at least one of the
* @return the names of the files which matched at least one of the
* include patterns and at at least one of the exclude patterns.
*
*/
*
*/
String[] getExcludedFiles();
/**
* Returns the names of the directories which matched at least one of the
* Returns the names of the directories which matched at least one of the
* include patterns and none of the exclude patterns.
* The names are relative to the base directory.
*
@@ -103,9 +105,9 @@ public interface FileScanner {
* include patterns and none of the exclude patterns.
*/
String[] getIncludedDirectories();
/**
* Returns the names of the files which matched at least one of the
* Returns the names of the files which matched at least one of the
* include patterns and none of the exclude patterns.
* The names are relative to the base directory.
*
@@ -113,72 +115,72 @@ public interface FileScanner {
* include patterns and none of the exclude patterns.
*/
String[] getIncludedFiles();
/**
* Returns the names of the directories which matched none of the include
* patterns. The names are relative to the base directory.
*
* @return the names of the directories which matched none of the include
* patterns.
*/
*/
String[] getNotIncludedDirectories();
/**
* Returns the names of the files which matched none of the include
* Returns the names of the files which matched none of the include
* patterns. The names are relative to the base directory.
*
* @return the names of the files which matched none of the include
* @return the names of the files which matched none of the include
* patterns.
*/
String[] getNotIncludedFiles();
/**
* Scans the base directory for files which match at least one include
* pattern and don't match any exclude patterns.
*
* @exception IllegalStateException if the base directory was set
* @exception IllegalStateException if the base directory was set
* incorrectly (i.e. if it is <code>null</code>, doesn't exist,
* or isn't a directory).
*/
void scan() throws IllegalStateException;
/**
* Sets the base directory to be scanned. This is the directory which is
* scanned recursively. All '/' and '\' characters should be replaced by
* <code>File.separatorChar</code>, so the separator used need not match
* <code>File.separatorChar</code>.
*
* @param basedir The base directory to scan.
* @param basedir The base directory to scan.
* Must not be <code>null</code>.
*/
void setBasedir(String basedir);
/**
* Sets the base directory to be scanned. This is the directory which is
* Sets the base directory to be scanned. This is the directory which is
* scanned recursively.
*
* @param basedir The base directory for scanning.
* @param basedir The base directory for scanning.
* Should not be <code>null</code>.
*/
void setBasedir(File basedir);
/**
* Sets the list of exclude patterns to use.
*
* @param excludes A list of exclude patterns.
* May be <code>null</code>, indicating that no files
* should be excluded. If a non-<code>null</code> list is
* @param excludes A list of exclude patterns.
* May be <code>null</code>, indicating that no files
* should be excluded. If a non-<code>null</code> list is
* given, all elements must be non-<code>null</code>.
*/
*/
void setExcludes(String[] excludes);
/**
* Sets the list of include patterns to use.
*
* @param includes A list of include patterns.
* May be <code>null</code>, indicating that all files
* May be <code>null</code>, indicating that all files
* should be included. If a non-<code>null</code>
* list is given, all elements must be
* list is given, all elements must be
* non-<code>null</code>.
*/
void setIncludes(String[] includes);
@@ -186,7 +188,7 @@ public interface FileScanner {
/**
* Sets whether or not the file system should be regarded as case sensitive.
*
* @param isCaseSensitive whether or not the file system should be
* @param isCaseSensitive whether or not the file system should be
* regarded as a case sensitive one
*/
void setCaseSensitive(boolean isCaseSensitive);


+ 2
- 2
src/main/org/apache/tools/ant/IntrospectionHelper.java View File

@@ -1073,7 +1073,7 @@ public class IntrospectionHelper implements BuildListener {
}
addTypeMethods.add(method);
}

/**
* Search the list of methods to find the first method
@@ -1082,7 +1082,7 @@ public class IntrospectionHelper implements BuildListener {
private Method findMatchingMethod(Class paramClass, List methods) {
Class matchedClass = null;
Method matchedMethod = null;
for (int i = 0; i < methods.size(); ++i) {
Method method = (Method) methods.get(i);
Class methodClass = method.getParameterTypes()[0];


+ 9
- 9
src/main/org/apache/tools/ant/Location.java View File

@@ -66,7 +66,7 @@ import org.xml.sax.Locator;
* @author Matt Foemmel
*/
public class Location implements Serializable {
/** Name of the file. */
private String fileName;
/** Line number within the file. */
@@ -87,7 +87,7 @@ public class Location implements Serializable {
/**
* Creates a location consisting of a file name but no line number or
* column number.
*
*
* @param fileName The name of the file. May be <code>null</code>,
* in which case the location is equivalent to
* {@link #UNKNOWN_LOCATION UNKNOWN_LOCATION}.
@@ -99,7 +99,7 @@ public class Location implements Serializable {
/**
* Creates a location from the SAX locator using the system ID as
* the filename.
*
*
* @param loc Must not be <code>null</code>.
*
* @since Ant 1.6
@@ -111,11 +111,11 @@ public class Location implements Serializable {
/**
* Creates a location consisting of a file name, line number and
* column number.
*
*
* @param fileName The name of the file. May be <code>null</code>,
* in which case the location is equivalent to
* {@link #UNKNOWN_LOCATION UNKNOWN_LOCATION}.
*
*
* @param lineNumber Line number within the file. Use 0 for unknown
* positions within a file.
* @param columnNumber Column number within the line.
@@ -125,16 +125,16 @@ public class Location implements Serializable {
this.fileName = FileUtils.newFileUtils().fromURI(fileName);
} else {
this.fileName = fileName;
}
}
this.lineNumber = lineNumber;
this.columnNumber = columnNumber;
}

/**
* Returns the file name, line number, a colon and a trailing space.
* An error message can be appended easily. For unknown locations, an
* Returns the file name, line number, a colon and a trailing space.
* An error message can be appended easily. For unknown locations, an
* empty string is returned.
*
*
* @return a String of the form <code>"fileName: lineNumber: "</code>
* if both file name and line number are known,
* <code>"fileName: "</code> if only the file name is known,


+ 6
- 6
src/main/org/apache/tools/ant/Main.java View File

@@ -112,7 +112,7 @@ public class Main implements AntMain {

/** Indicates whether this build is to support interactive input */
private boolean allowInput = true;
/**
* The Ant logger class. There may be only one logger. It will have
* the right to use the 'out' PrintStream. The class must implements the
@@ -180,7 +180,7 @@ public class Main implements AntMain {
Main m = new Main();
m.startAnt(args, additionalUserProperties, coreLoader);
}
/**
* Start Ant
* @param args command line args
@@ -189,7 +189,7 @@ public class Main implements AntMain {
* @param coreLoader - not used
*
* @since Ant 1.6
*/
*/
public void startAnt(String[] args, Properties additionalUserProperties,
ClassLoader coreLoader) {

@@ -270,7 +270,7 @@ public class Main implements AntMain {
*/
public Main() {
}
/**
* Sole constructor, which parses and deals with command line
* arguments.
@@ -283,7 +283,7 @@ public class Main implements AntMain {
protected Main(String[] args) throws BuildException {
processArgs(args);
}
/**
* Process command line arguments
*
@@ -610,7 +610,7 @@ public class Main implements AntMain {
//System.setSecurityManager(new NoExitSecurityManager());
}
try {
if (allowInput) {
if (allowInput) {
project.setDefaultInputStream(System.in);
}
System.setIn(new DemuxInputStream(project));


+ 8
- 8
src/main/org/apache/tools/ant/NoBannerLogger.java View File

@@ -63,11 +63,11 @@ import org.apache.tools.ant.util.StringUtils;
*/
public class NoBannerLogger extends DefaultLogger {

/**
/**
* Name of the current target, if it should
* be displayed on the next message. This is
* set when a target starts building, and reset
* to <code>null</code> after the first message for
* to <code>null</code> after the first message for
* the target is logged.
*/
protected String targetName;
@@ -79,7 +79,7 @@ public class NoBannerLogger extends DefaultLogger {
/**
* Notes the name of the target so it can be logged
* if it generates any messages.
*
*
* @param event A BuildEvent containing target information.
* Must not be <code>null</code>.
*/
@@ -87,9 +87,9 @@ public class NoBannerLogger extends DefaultLogger {
targetName = event.getTarget().getName();
}

/**
/**
* Resets the current target name to <code>null</code>.
*
*
* @param event Ignored in this implementation.
*/
public void targetFinished(BuildEvent event) {
@@ -101,14 +101,14 @@ public class NoBannerLogger extends DefaultLogger {
* priority, also logging the name of the target if this
* is the first message which needs to be logged for the
* target.
*
*
* @param event A BuildEvent containing message information.
* Must not be <code>null</code>.
*/
public void messageLogged(BuildEvent event) {

if (event.getPriority() > msgOutputLevel
|| null == event.getMessage()
if (event.getPriority() > msgOutputLevel
|| null == event.getMessage()
|| "".equals(event.getMessage().trim())) {
return;
}


+ 21
- 21
src/main/org/apache/tools/ant/PathTokenizer.java View File

@@ -66,14 +66,14 @@ import org.apache.tools.ant.taskdefs.condition.Os;
* of either '/' or '\'.
*
* @author Conor MacNeill
* @author <a href="mailto:jtulley@novell.com">Jeff Tulley</a>
*/
* @author <a href="mailto:jtulley@novell.com">Jeff Tulley</a>
*/
public class PathTokenizer {
/**
* A tokenizer to break the string up based on the ':' or ';' separators.
*/
private StringTokenizer tokenizer;
/**
* A String which stores any path components which have been read ahead
* due to DOS filesystem compensation.
@@ -95,12 +95,12 @@ public class PathTokenizer {

/**
* Constructs a path tokenizer for the specified path.
*
*
* @param path The path to tokenize. Must not be <code>null</code>.
*/
public PathTokenizer(String path) {
if (onNetWare) {
// For NetWare, use the boolean=true mode, so we can use delimiter
// For NetWare, use the boolean=true mode, so we can use delimiter
// information to make a better decision later.
tokenizer = new StringTokenizer(path, ":;", true);
} else {
@@ -108,31 +108,31 @@ public class PathTokenizer {
// enough information to tokenize correctly.
tokenizer = new StringTokenizer(path, ":;", false);
}
dosStyleFilesystem = File.pathSeparatorChar == ';';
dosStyleFilesystem = File.pathSeparatorChar == ';';
}

/**
* Tests if there are more path elements available from this tokenizer's
* path. If this method returns <code>true</code>, then a subsequent call
* path. If this method returns <code>true</code>, then a subsequent call
* to nextToken will successfully return a token.
*
* @return <code>true</code> if and only if there is at least one token
*
* @return <code>true</code> if and only if there is at least one token
* in the string after the current position; <code>false</code> otherwise.
*/
public boolean hasMoreTokens() {
if (lookahead != null) {
return true;
}
return tokenizer.hasMoreTokens();
}
/**
* Returns the next path element from this tokenizer.
*
*
* @return the next path element from this tokenizer.
*
* @exception NoSuchElementException if there are no more elements in this
*
* @exception NoSuchElementException if there are no more elements in this
* tokenizer's path.
*/
public String nextToken() throws NoSuchElementException {
@@ -142,8 +142,8 @@ public class PathTokenizer {
lookahead = null;
} else {
token = tokenizer.nextToken().trim();
}
}
if (!onNetWare) {
if (token.length() == 1 && Character.isLetter(token.charAt(0))
&& dosStyleFilesystem
@@ -153,7 +153,7 @@ public class PathTokenizer {
String nextToken = tokenizer.nextToken().trim();
if (nextToken.startsWith("\\") || nextToken.startsWith("/")) {
// we know we are on a DOS style platform and the next path
// starts with a slash or backslash, so we know this is a
// starts with a slash or backslash, so we know this is a
// drive spec
token += ":" + nextToken;
} else {
@@ -168,15 +168,15 @@ public class PathTokenizer {
// ignore ";" and get the next token
token = tokenizer.nextToken().trim();
}
if (tokenizer.hasMoreTokens()) {
// this path could be a drive spec, so look at the next token
String nextToken = tokenizer.nextToken().trim();
// make sure we aren't going to get the path separator next
if (!nextToken.equals(File.pathSeparator)) {
if (nextToken.equals(":")) {
if (!token.startsWith("/") && !token.startsWith("\\")){
if (!token.startsWith("/") && !token.startsWith("\\")){
// it indeed is a drive spec, get the next bit
String oneMore = tokenizer.nextToken().trim();
if (!oneMore.equals(File.pathSeparator)) {
@@ -198,4 +198,4 @@ public class PathTokenizer {
return token;
}
}

+ 2
- 2
src/main/org/apache/tools/ant/ProjectComponent.java View File

@@ -95,7 +95,7 @@ public abstract class ProjectComponent {
public Project getProject() {
return project;
}
/**
* Logs a message with the default (INFO) priority.
*
@@ -109,7 +109,7 @@ public abstract class ProjectComponent {
* Logs a mesage with the given priority.
*
* @param msg The message to be logged. Should not be <code>null</code>.
* @param msgLevel the message priority at which this message is
* @param msgLevel the message priority at which this message is
* to be logged.
*/
public void log(String msg, int msgLevel) {


+ 9
- 9
src/main/org/apache/tools/ant/RuntimeConfigurable.java View File

@@ -79,18 +79,18 @@ public class RuntimeConfigurable implements Serializable {

/** Name of the element to configure. */
private String elementTag = null;
/** List of child element wrappers. */
private List/*<RuntimeConfigurable>*/ children = null;
/** The element to configure. It is only used during
* maybeConfigure.
*/
private transient Object wrappedObject = null;

/**
/**
* @deprecated
* XML attributes for the element.
* XML attributes for the element.
*/
private transient AttributeList attributes;

@@ -102,13 +102,13 @@ public class RuntimeConfigurable implements Serializable {
* XXX under JDK 1.4 you can just use a LinkedHashMap for this purpose -jglick
*/
private List/*<String>*/ attributeNames = null;
/** Map of attribute names to values */
private Map/*<String,String>*/ attributeMap = null;

/** Text appearing within the element. */
private StringBuffer characters = null;
/** Indicates if the wrapped object has been configured */
private boolean proxyConfigured = false;

@@ -239,7 +239,7 @@ public class RuntimeConfigurable implements Serializable {
return new EmptyEnumeration();
}
}
static final class EmptyEnumeration implements Enumeration {
public EmptyEnumeration() {}
public boolean hasMoreElements() {
@@ -370,7 +370,7 @@ public class RuntimeConfigurable implements Serializable {
for (int i = 0; i < attributeNames.size(); i++) {
String name = (String) attributeNames.get(i);
String value = (String) attributeMap.get(name);
// reflect these into the target
value = p.replaceProperties(value);
try {
@@ -420,7 +420,7 @@ public class RuntimeConfigurable implements Serializable {
}
proxyConfigured = true;
}
/**
* Reconfigure the element, even if it has already been configured.
*


+ 45
- 45
src/main/org/apache/tools/ant/Target.java View File

@@ -86,11 +86,11 @@ public class Target implements TaskContainer {
/** Sole constructor. */
public Target() {
}
/**
* Sets the project this target belongs to.
*
* @param project The project this target belongs to.
/**
* Sets the project this target belongs to.
*
* @param project The project this target belongs to.
* Must not be <code>null</code>.
*/
public void setProject(Project project) {
@@ -99,8 +99,8 @@ public class Target implements TaskContainer {

/**
* Returns the project this target belongs to.
*
* @return The project this target belongs to, or <code>null</code> if
*
* @return The project this target belongs to, or <code>null</code> if
* the project has not been set yet.
*/
public Project getProject() {
@@ -110,7 +110,7 @@ public class Target implements TaskContainer {
/**
* Sets the list of targets this target is dependent on.
* The targets themselves are not resolved at this time.
*
*
* @param depS A comma-separated list of targets this target
* depends on. Must not be <code>null</code>.
*/
@@ -124,19 +124,19 @@ public class Target implements TaskContainer {
// Make sure the dependency is not empty string
if (token.equals("") || token.equals(",")) {
throw new BuildException("Syntax Error: Depend "
+ "attribute for target \"" + getName()
+ "attribute for target \"" + getName()
+ "\" has an empty string for dependency.");
}

addDependency(token);
// Make sure that depends attribute does not
// end in a ,
if (tok.hasMoreTokens()) {
token = tok.nextToken();
if (!tok.hasMoreTokens() || !token.equals(",")) {
throw new BuildException("Syntax Error: Depend "
+ "attribute for target \"" + getName()
throw new BuildException("Syntax Error: Depend "
+ "attribute for target \"" + getName()
+ "\" ends with a , character");
}
}
@@ -146,7 +146,7 @@ public class Target implements TaskContainer {

/**
* Sets the name of this target.
*
*
* @param name The name of this target. Should not be <code>null</code>.
*/
public void setName(String name) {
@@ -155,7 +155,7 @@ public class Target implements TaskContainer {

/**
* Returns the name of this target.
*
*
* @return the name of this target, or <code>null</code> if the
* name has not been set yet.
*/
@@ -165,7 +165,7 @@ public class Target implements TaskContainer {

/**
* Adds a task to this target.
*
*
* @param task The task to be added. Must not be <code>null</code>.
*/
public void addTask(Task task) {
@@ -174,17 +174,17 @@ public class Target implements TaskContainer {

/**
* Adds the wrapper for a data type element to this target.
*
* @param r The wrapper for the data type element to be added.
*
* @param r The wrapper for the data type element to be added.
* Must not be <code>null</code>.
*/
public void addDataType(RuntimeConfigurable r) {
children.add(r);
}

/**
/**
* Returns the current set of tasks to be executed by this target.
*
*
* @return an array of the tasks currently within this target
*/
public Task[] getTasks() {
@@ -196,13 +196,13 @@ public class Target implements TaskContainer {
tasks.add(o);
}
}
return (Task[])tasks.toArray(new Task[tasks.size()]);
}

/**
* Adds a dependency to this target.
*
*
* @param dependency The name of a target this target is dependent on.
* Must not be <code>null</code>.
*/
@@ -215,7 +215,7 @@ public class Target implements TaskContainer {

/**
* Returns an enumeration of the dependencies of this target.
*
*
* @return an enumeration of the dependencies of this target
*/
public Enumeration getDependencies() {
@@ -234,7 +234,7 @@ public class Target implements TaskContainer {
* property <code>foo</code> has value <code>bar</code>, setting
* the "if" condition to <code>${foo}_x</code> will mean that the
* task will only execute if property <code>bar_x</code> is set.
*
*
* @param property The property condition to test on execution.
* May be <code>null</code>, in which case
* no "if" test is performed.
@@ -242,7 +242,7 @@ public class Target implements TaskContainer {
public void setIf(String property) {
this.ifCondition = (property == null) ? "" : property;
}
/**
* Sets the "unless" condition to test on execution. This is the
* name of a property to test for existence - if the property
@@ -251,7 +251,7 @@ public class Target implements TaskContainer {
* property <code>foo</code> has value <code>bar</code>, setting
* the "unless" condition to <code>${foo}_x</code> will mean that the
* task will only execute if property <code>bar_x</code> isn't set.
*
*
* @param property The property condition to test on execution.
* May be <code>null</code>, in which case
* no "unless" test is performed.
@@ -262,9 +262,9 @@ public class Target implements TaskContainer {

/**
* Sets the description of this target.
*
* @param description The description for this target.
* May be <code>null</code>, indicating that no
*
* @param description The description for this target.
* May be <code>null</code>, indicating that no
* description is available.
*/
public void setDescription(String description) {
@@ -273,7 +273,7 @@ public class Target implements TaskContainer {

/**
* Returns the description of this target.
*
*
* @return the description of this target, or <code>null</code> if no
* description is available.
*/
@@ -283,7 +283,7 @@ public class Target implements TaskContainer {

/**
* Returns the name of this target.
*
*
* @return the name of this target, or <code>null</code> if the
* name has not been set yet.
*/
@@ -297,12 +297,12 @@ public class Target implements TaskContainer {
* method, as it does no checking of its own. If either the "if"
* or "unless" test prevents this target from being executed, a verbose
* message is logged giving the reason. It is recommended that clients
* of this class call performTasks rather than this method so that
* of this class call performTasks rather than this method so that
* appropriate build events are fired.
*
*
* @exception BuildException if any of the tasks fail or if a data type
* configuration fails.
*
*
* @see #performTasks()
* @see #setIf(String)
* @see #setUnless(String)
@@ -321,21 +321,21 @@ public class Target implements TaskContainer {
}
}
} else if (!testIfCondition()) {
project.log(this, "Skipped because property '"
+ project.replaceProperties(this.ifCondition)
project.log(this, "Skipped because property '"
+ project.replaceProperties(this.ifCondition)
+ "' not set.", Project.MSG_VERBOSE);
} else {
project.log(this, "Skipped because property '"
+ project.replaceProperties(this.unlessCondition)
project.log(this, "Skipped because property '"
+ project.replaceProperties(this.unlessCondition)
+ "' set.", Project.MSG_VERBOSE);
}
}

/**
* Performs the tasks within this target (if the conditions are met),
* firing target started/target finished messages around a call to
* firing target started/target finished messages around a call to
* execute.
*
*
* @see #execute()
*/
public final void performTasks() {
@@ -348,11 +348,11 @@ public class Target implements TaskContainer {
throw exc;
}
}
/**
* Replaces all occurrences of the given task in the list
* of children with the replacement data type wrapper.
*
*
* @param el The task to replace.
* Must not be <code>null</code>.
* @param o The data type wrapper to replace <code>el</code> with.
@@ -367,7 +367,7 @@ public class Target implements TaskContainer {
/**
* Replaces all occurrences of the given task in the list
* of children with the replacement task.
*
*
* @param el The task to replace.
* Must not be <code>null</code>.
* @param o The task to replace <code>el</code> with.
@@ -381,7 +381,7 @@ public class Target implements TaskContainer {

/**
* Tests whether or not the "if" condition is satisfied.
*
*
* @return whether or not the "if" condition is satisfied. If no
* condition (or an empty condition) has been set,
* <code>true</code> is returned.
@@ -392,14 +392,14 @@ public class Target implements TaskContainer {
if ("".equals(ifCondition)) {
return true;
}
String test = project.replaceProperties(ifCondition);
return project.getProperty(test) != null;
}

/**
* Tests whether or not the "unless" condition is satisfied.
*
*
* @return whether or not the "unless" condition is satisfied. If no
* condition (or an empty condition) has been set,
* <code>true</code> is returned.


+ 5
- 5
src/main/org/apache/tools/ant/Task.java View File

@@ -303,7 +303,7 @@ public abstract class Task extends ProjectComponent {
wrapper.reconfigure(getProject());
}
}
/**
* Handles a line of output by logging it with the INFO priority.
*
@@ -332,15 +332,15 @@ public abstract class Task extends ProjectComponent {
* @param length the amount of data to read
*
* @return the number of bytes read
*
*
* @exception IOException if the data cannot be read
* @since Ant 1.6
*/
protected int handleInput(byte[] buffer, int offset, int length)
protected int handleInput(byte[] buffer, int offset, int length)
throws IOException {
return getProject().defaultInput(buffer, offset, length);
}
/**
* Handles an error line by logging it with the INFO priority.
*
@@ -426,7 +426,7 @@ public abstract class Task extends ProjectComponent {
/**
* Has this task been marked invalid?
*
* @return true if this task is no longer valid. A new task should be
* @return true if this task is no longer valid. A new task should be
* configured in this case.
*
* @since Ant 1.5


+ 21
- 21
src/main/org/apache/tools/ant/TaskAdapter.java View File

@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -58,7 +58,7 @@ import java.lang.reflect.Method;

/**
* Uses introspection to "adapt" an arbitrary Bean which doesn't
* itself extend Task, but still contains an execute method and optionally
* itself extend Task, but still contains an execute method and optionally
* a setProject method.
*
* @author costin@dnt.ro
@@ -67,26 +67,26 @@ public class TaskAdapter extends Task implements TypeAdapter {

/** Object to act as a proxy for. */
private Object proxy;
/**
* Checks whether or not a class is suitable to be adapted by TaskAdapter.
*
* This only checks conditions which are additionally required for
* This only checks conditions which are additionally required for
* tasks adapted by TaskAdapter. Thus, this method should be called by
* Project.checkTaskClass.
*
* Throws a BuildException and logs as Project.MSG_ERR for
* conditions that will cause the task execution to fail.
* Logs other suspicious conditions with Project.MSG_WARN.
*
* @param taskClass Class to test for suitability.
*
* @param taskClass Class to test for suitability.
* Must not be <code>null</code>.
* @param project Project to log warnings/errors to.
* @param project Project to log warnings/errors to.
* Must not be <code>null</code>.
*
*
* @see Project#checkTaskClass(Class)
*/
public static void checkTaskClass(final Class taskClass,
public static void checkTaskClass(final Class taskClass,
final Project project) {
// don't have to check for interface, since then
// taskClass would be abstract too.
@@ -97,8 +97,8 @@ public class TaskAdapter extends Task implements TypeAdapter {
// don't have to check for abstract, since then
// taskClass would be abstract too.
if (!Void.TYPE.equals(executeM.getReturnType())) {
final String message = "return type of execute() should be "
+ "void but was \"" + executeM.getReturnType() + "\" in "
final String message = "return type of execute() should be "
+ "void but was \"" + executeM.getReturnType() + "\" in "
+ taskClass;
project.log(message, Project.MSG_WARN);
}
@@ -116,10 +116,10 @@ public class TaskAdapter extends Task implements TypeAdapter {
public void checkProxyClass(Class proxyClass) {
checkTaskClass(proxyClass, getProject());
}
/**
* Executes the proxied task.
*
*
* @exception BuildException if the project could not be set
* or the method could not be executed.
*/
@@ -127,7 +127,7 @@ public class TaskAdapter extends Task implements TypeAdapter {
Method setProjectM = null;
try {
Class c = proxy.getClass();
setProjectM =
setProjectM =
c.getMethod("setProject", new Class[] {Project.class});
if (setProjectM != null) {
setProjectM.invoke(proxy, new Object[] {getProject()});
@@ -136,7 +136,7 @@ public class TaskAdapter extends Task implements TypeAdapter {
// ignore this if the class being used as a task does not have
// a set project method.
} catch (Exception ex) {
log("Error setting project in " + proxy.getClass(),
log("Error setting project in " + proxy.getClass(),
Project.MSG_ERR);
throw new BuildException(ex);
}
@@ -147,13 +147,13 @@ public class TaskAdapter extends Task implements TypeAdapter {
Class c = proxy.getClass();
executeM = c.getMethod("execute", new Class[0]);
if (executeM == null) {
log("No public execute() in " + proxy.getClass(),
log("No public execute() in " + proxy.getClass(),
Project.MSG_ERR);
throw new BuildException("No public execute() in "
throw new BuildException("No public execute() in "
+ proxy.getClass());
}
executeM.invoke(proxy, null);
return;
return;
} catch (java.lang.reflect.InvocationTargetException ie) {
log("Error in " + proxy.getClass(), Project.MSG_VERBOSE);
Throwable t = ie.getTargetException();
@@ -168,10 +168,10 @@ public class TaskAdapter extends Task implements TypeAdapter {
}

}
/**
* Sets the target object to proxy for.
*
*
* @param o The target object. Must not be <code>null</code>.
*/
public void setProxy(Object o) {
@@ -180,7 +180,7 @@ public class TaskAdapter extends Task implements TypeAdapter {

/**
* Returns the target object being proxied.
*
*
* @return the target proxy object
*/
public Object getProxy() {


+ 20
- 20
src/main/org/apache/tools/ant/UnknownElement.java View File

@@ -75,10 +75,10 @@ public class UnknownElement extends Task {
* been redefined since original creation.
*/
private String elementName;
/**
/**
* Holds the namespace of the element.
*/
*/
private String namespace;

/**
@@ -113,18 +113,18 @@ public class UnknownElement extends Task {
}

/** Return the namespace of the XML element associated with this component.
*
*
* @return Namespace URI used in the xmlns declaration.
*/
*/
public String getNamespace() {
return namespace;
}

/** Set the namespace of the XML element associated with this component.
* This method is typically called by the XML processor.
*
*
* @param namespace URI used in the xmlns declaration.
*/
*/
public void setNamespace(String namespace) {
this.namespace = namespace;
}
@@ -163,7 +163,7 @@ public class UnknownElement extends Task {
*/
public void configure(Object realObject) {
realThing = realObject;
getWrapper().setProxy(realThing);
Task task = null;
if (realThing instanceof Task) {
@@ -181,7 +181,7 @@ public class UnknownElement extends Task {
// configure attributes of the object and it's children. If it is
// a task container, defer the configuration till the task container
// attempts to use the task
if (task != null) {
task.maybeConfigure();
} else {
@@ -204,17 +204,17 @@ public class UnknownElement extends Task {

/**
* @see Task#handleInput(byte[], int, int)
*
*
* @since Ant 1.6
*/
protected int handleInput(byte[] buffer, int offset, int length)
protected int handleInput(byte[] buffer, int offset, int length)
throws IOException {
if (realThing instanceof Task) {
return ((Task) realThing).handleInput(buffer, offset, length);
} else {
return super.handleInput(buffer, offset, length);
}
}
/**
* Handles output sent to System.out by this task or its real task.
@@ -255,7 +255,7 @@ public class UnknownElement extends Task {
super.handleErrorOutput(line);
}
}
/**
* Executes the real object if it's a task. If it's not a task
* (e.g. a data type) then this method does nothing.
@@ -317,18 +317,18 @@ public class UnknownElement extends Task {
for (int i = 0; it.hasNext(); i++) {
RuntimeConfigurable childWrapper = parentWrapper.getChild(i);
UnknownElement child = (UnknownElement) it.next();
// backwards compatibility - element names of nested
// elements have been all lower-case in Ant, except for
// TaskContainers
if (!handleChild(ih, parent, child,
child.getTag().toLowerCase(Locale.US),
if (!handleChild(ih, parent, child,
child.getTag().toLowerCase(Locale.US),
childWrapper)) {
if (!(parent instanceof TaskContainer)) {
ih.throwNotSupported(getProject(), parent,
ih.throwNotSupported(getProject(), parent,
child.getTag());
} else {
// a task container - anything could happen - just add the
// a task container - anything could happen - just add the
// child to the container
TaskContainer container = (TaskContainer) parent;
container.addTask(child);
@@ -466,8 +466,8 @@ public class UnknownElement extends Task {
Object parent, UnknownElement child,
String childTag,
RuntimeConfigurable childWrapper) {
if (ih.supportsNestedElement(childTag)) {
Object realChild
if (ih.supportsNestedElement(childTag)) {
Object realChild
= ih.createElement(getProject(), parent, childTag);
childWrapper.setProxy(realChild);
if (realChild instanceof Task) {


+ 2
- 2
src/main/org/apache/tools/ant/XmlLogger.java View File

@@ -289,7 +289,7 @@ public class XmlLogger implements BuildLogger {
TimedElement poppedStack = (TimedElement) threadStack.pop();
if (poppedStack != targetElement) {
throw new RuntimeException("Mismatch - popped element = "
+ poppedStack.element
+ poppedStack.element
+ " finished target element = "
+ targetElement.element);
}
@@ -480,7 +480,7 @@ public class XmlLogger implements BuildLogger {
/**
* Ignore emacs mode, as it has no meaning in XML format
*
* @param emacsMode true if logger should produce emacs compatible
* @param emacsMode true if logger should produce emacs compatible
* output
*/
public void setEmacsMode(boolean emacsMode) {


+ 17
- 17
src/main/org/apache/tools/ant/filters/BaseFilterReader.java View File

@@ -95,7 +95,7 @@ public abstract class BaseFilterReader
*
* @param in A Reader object providing the underlying stream.
* Must not be <code>null</code>.
*
*
*/
public BaseFilterReader(final Reader in) {
super(in);
@@ -106,7 +106,7 @@ public abstract class BaseFilterReader
* until some input is available, an I/O error occurs, or the end of the
* stream is reached.
*
* @param cbuf Destination buffer to write characters to.
* @param cbuf Destination buffer to write characters to.
* Must not be <code>null</code>.
* @param off Offset at which to start storing characters.
* @param len Maximum number of characters to read.
@@ -143,7 +143,7 @@ public abstract class BaseFilterReader
* @exception IllegalArgumentException If <code>n</code> is negative.
* @exception IOException If an I/O error occurs
*/
public final long skip(final long n)
public final long skip(final long n)
throws IOException, IllegalArgumentException {
if (n < 0L) {
throw new IllegalArgumentException("skip value is negative");
@@ -159,7 +159,7 @@ public abstract class BaseFilterReader

/**
* Sets the initialized status.
*
*
* @param initialized Whether or not the filter is initialized.
*/
protected final void setInitialized(final boolean initialized) {
@@ -168,7 +168,7 @@ public abstract class BaseFilterReader

/**
* Returns the initialized status.
*
*
* @return whether or not the filter is initialized
*/
protected final boolean getInitialized() {
@@ -177,8 +177,8 @@ public abstract class BaseFilterReader

/**
* Sets the project to work with.
*
* @param project The project this filter is part of.
*
* @param project The project this filter is part of.
* Should not be <code>null</code>.
*/
public final void setProject(final Project project) {
@@ -187,7 +187,7 @@ public abstract class BaseFilterReader

/**
* Returns the project this filter is part of.
*
*
* @return the project this filter is part of
*/
protected final Project getProject() {
@@ -197,22 +197,22 @@ public abstract class BaseFilterReader
/**
* Reads a line of text ending with '\n' (or until the end of the stream).
* The returned String retains the '\n'.
*
*
* @return the line read, or <code>null</code> if the end of the stream
* has already been reached
*
* @exception IOException if the underlying reader throws one during
*
* @exception IOException if the underlying reader throws one during
* reading
*/
protected final String readLine() throws IOException {
int ch = in.read();
if (ch == -1) {
return null;
}
StringBuffer line = new StringBuffer();
while (ch != -1) {
line.append ((char) ch);
if (ch == '\n') {
@@ -225,10 +225,10 @@ public abstract class BaseFilterReader

/**
* Reads to the end of the stream, returning the contents as a String.
*
*
* @return the remaining contents of the reader, as a String
*
* @exception IOException if the underlying reader throws one during
*
* @exception IOException if the underlying reader throws one during
* reading
*/
protected final String readFully() throws IOException {


+ 3
- 3
src/main/org/apache/tools/ant/filters/BaseParamFilterReader.java View File

@@ -70,7 +70,7 @@ public abstract class BaseParamFilterReader

/**
* Constructor for "dummy" instances.
*
*
* @see BaseFilterReader#BaseFilterReader()
*/
public BaseParamFilterReader() {
@@ -90,7 +90,7 @@ public abstract class BaseParamFilterReader
/**
* Sets the parameters used by this filter, and sets
* the filter to an uninitialized status.
*
*
* @param parameters The parameters to be used by this filter.
* Should not be <code>null</code>.
*/
@@ -101,7 +101,7 @@ public abstract class BaseParamFilterReader

/**
* Returns the parameters to be used by this filter.
*
*
* @return the parameters to be used by this filter
*/
protected final Parameter[] getParameters() {


+ 3
- 3
src/main/org/apache/tools/ant/filters/ChainableReader.java View File

@@ -64,11 +64,11 @@ public interface ChainableReader {
/**
* Returns a reader with the same configuration as this one,
* but filtering input from the specified reader.
*
*
* @param rdr the reader which the returned reader should be filtering
*
*
* @return a reader with the same configuration as this one, but
* filtering input from the specified reader
*/
public Reader chain(Reader rdr);
Reader chain(Reader rdr);
}

+ 9
- 8
src/main/org/apache/tools/ant/filters/ClassConstants.java View File

@@ -76,7 +76,8 @@ import java.lang.reflect.Method;
* Example:<br>
* <pre>&lt;classconstants/&gt;</pre>
* Or:
* <pre>&lt;filterreader classname=&quot;org.apache.tools.ant.filters.ClassConstants&quot;/&gt;</pre>
* <pre>&lt;filterreader
* classname=&quot;org.apache.tools.ant.filters.ClassConstants&quot;/&gt;</pre>
* @author Magesh Umasankar
*/
public final class ClassConstants
@@ -91,7 +92,7 @@ public final class ClassConstants

/**
* Constructor for "dummy" instances.
*
*
* @see BaseFilterReader#BaseFilterReader()
*/
public ClassConstants() {
@@ -100,7 +101,7 @@ public final class ClassConstants

/**
* Creates a new filtered reader. The contents of the passed-in reader
* are expected to be the name of the class from which to produce a
* are expected to be the name of the class from which to produce a
* list of constants.
*
* @param in A Reader object providing the underlying stream.
@@ -112,10 +113,10 @@ public final class ClassConstants

/**
* Reads and assembles the constants declared in a class file.
*
*
* @return the next character in the list of constants, or -1
* if the end of the resulting stream has been reached
*
*
* @exception IOException if the underlying stream throws an IOException
* during reading, or if the constants for the specified class cannot
* be read (for example due to the class not being found).
@@ -144,7 +145,7 @@ public final class ClassConstants
final Class javaClassHelper =
Class.forName(JAVA_CLASS_HELPER);
if (javaClassHelper != null) {
final Class params[] = {
final Class[] params = {
byte[].class
};
final Method getConstants =
@@ -180,10 +181,10 @@ public final class ClassConstants
/**
* Creates a new ClassConstants using the passed in
* Reader for instantiation.
*
*
* @param rdr A Reader object providing the underlying stream.
* Must not be <code>null</code>.
*
*
* @return a new filter based on this configuration, but filtering
* the specified reader
*/


+ 1
- 6
src/main/org/apache/tools/ant/filters/EscapeUnicode.java View File

@@ -66,7 +66,7 @@ import org.apache.tools.ant.types.Parameter;
*
* Or:
*
* <pre>&lt;filterreader
* <pre>&lt;filterreader
classname=&quot;org.apache.tools.ant.filters.EscapeUnicode&quot;/&gt;
* </pre>
*
@@ -161,11 +161,6 @@ public class EscapeUnicode
* Parses the parameters (currently unused)
*/
private final void initialize() {
Parameter[] params = getParameters();
if (params != null) {
for (int i = 0; i < params.length; i++) {
}
}
}
}


+ 9
- 8
src/main/org/apache/tools/ant/filters/ExpandProperties.java View File

@@ -63,8 +63,9 @@ import org.apache.tools.ant.Project;
* Example:<br>
* <pre>&lt;expandproperties/&gt;</pre>
* Or:
* <pre>&lt;filterreader classname=&quot;org.apache.tools.ant.filters.ExpandProperties&quot;/&gt;</pre>
*
* <pre>&lt;filterreader
* classname=&quot;org.apache.tools.ant.filters.ExpandProperties&quot;/&gt;</pre>
*
* @author Magesh Umasankar
*/
public final class ExpandProperties
@@ -75,7 +76,7 @@ public final class ExpandProperties

/**
* Constructor for "dummy" instances.
*
*
* @see BaseFilterReader#BaseFilterReader()
*/
public ExpandProperties() {
@@ -97,12 +98,12 @@ public final class ExpandProperties
* stream is first read in fully, and the Ant properties are expanded.
* The results of this expansion are then queued so they can be read
* character-by-character.
*
*
* @return the next character in the resulting stream, or -1
* if the end of the resulting stream has been reached
*
*
* @exception IOException if the underlying stream throws an IOException
* during reading
* during reading
*/
public final int read() throws IOException {

@@ -134,10 +135,10 @@ public final class ExpandProperties
/**
* Creates a new ExpandProperties filter using the passed in
* Reader for instantiation.
*
*
* @param rdr A Reader object providing the underlying stream.
* Must not be <code>null</code>.
*
*
* @return a new filter based on this configuration, but filtering
* the specified reader
*/


+ 10
- 5
src/main/org/apache/tools/ant/filters/HeadFilter.java View File

@@ -82,15 +82,18 @@ public final class HeadFilter
/** Number of lines currently read in. */
private long linesRead = 0;

/** Default number of lines to show */
private static int DEFAULT_NUM_LINES = 10;

/** Number of lines to be returned in the filtered stream. */
private long lines = 10;
private long lines = DEFAULT_NUM_LINES;

/** Number of lines to be skipped. */
private long skip = 0;

/** A line tokenizer */
private TokenFilter.LineTokenizer lineTokenizer = null;
/** the current line from the input stream */
private String line = null;
/** the position in the current line */
@@ -137,16 +140,18 @@ public final class HeadFilter

while (line == null || line.length() == 0) {
line = lineTokenizer.getToken(in);
if (line == null)
if (line == null) {
return -1;
}
line = headFilter(line);
linePos = 0;
}

int ch = line.charAt(linePos);
linePos++;
if (linePos == line.length())
if (linePos == line.length()) {
line = null;
}
return ch;
}

@@ -171,7 +176,7 @@ public final class HeadFilter
/**
* Sets the number of lines to be skipped in the filtered stream.
*
* @param lines the number of lines to be skipped in the filtered stream
* @param skip the number of lines to be skipped in the filtered stream
*/
public final void setSkip(final long skip) {
this.skip = skip;


+ 16
- 16
src/main/org/apache/tools/ant/filters/LineContainsRegExp.java View File

@@ -118,7 +118,7 @@ public final class LineContainsRegExp
* Returns the next character in the filtered stream, only including
* lines from the original stream which match all of the specified
* regular expressions.
*
*
* @return the next character in the resulting stream, or -1
* if the end of the resulting stream has been reached
*
@@ -174,8 +174,8 @@ public final class LineContainsRegExp

/**
* Adds a <code>regexp</code> element.
*
* @param regExp The <code>regexp</code> element to add.
*
* @param regExp The <code>regexp</code> element to add.
* Must not be <code>null</code>.
*/
public final void addConfiguredRegexp(final RegularExpression regExp) {
@@ -183,12 +183,12 @@ public final class LineContainsRegExp
}

/**
* Sets the vector of regular expressions which must be contained within
* a line read from the original stream in order for it to match this
* Sets the vector of regular expressions which must be contained within
* a line read from the original stream in order for it to match this
* filter.
*
* @param regexps A vector of regular expressions which must be contained
* within a line in order for it to match in this filter. Must not be
*
* @param regexps A vector of regular expressions which must be contained
* within a line in order for it to match in this filter. Must not be
* <code>null</code>.
*/
private void setRegexps(final Vector regexps) {
@@ -196,13 +196,13 @@ public final class LineContainsRegExp
}

/**
* Returns the vector of regular expressions which must be contained within
* a line read from the original stream in order for it to match this
* Returns the vector of regular expressions which must be contained within
* a line read from the original stream in order for it to match this
* filter.
*
* @return the vector of regular expressions which must be contained within
* a line read from the original stream in order for it to match this
* filter. The returned object is "live" - in other words, changes made to
*
* @return the vector of regular expressions which must be contained within
* a line read from the original stream in order for it to match this
* filter. The returned object is "live" - in other words, changes made to
* the returned object are mirrored in the filter.
*/
private final Vector getRegexps() {
@@ -212,10 +212,10 @@ public final class LineContainsRegExp
/**
* Creates a new LineContainsRegExp using the passed in
* Reader for instantiation.
*
*
* @param rdr A Reader object providing the underlying stream.
* Must not be <code>null</code>.
*
*
* @return a new filter based on this configuration, but filtering
* the specified reader
*/


+ 8
- 8
src/main/org/apache/tools/ant/filters/PrefixLines.java View File

@@ -85,7 +85,7 @@ public final class PrefixLines

/**
* Constructor for "dummy" instances.
*
*
* @see BaseFilterReader#BaseFilterReader()
*/
public PrefixLines() {
@@ -107,12 +107,12 @@ public final class PrefixLines
* from the original input, and the prefix added. The resulting
* line is then used until it ends, at which point the next original line
* is read, etc.
*
*
* @return the next character in the resulting stream, or -1
* if the end of the resulting stream has been reached
*
*
* @exception IOException if the underlying stream throws an IOException
* during reading
* during reading
*/
public final int read() throws IOException {
if (!getInitialized()) {
@@ -148,7 +148,7 @@ public final class PrefixLines

/**
* Sets the prefix to add at the start of each input line.
*
*
* @param prefix The prefix to add at the start of each input line.
* May be <code>null</code>, in which case no prefix
* is added.
@@ -159,7 +159,7 @@ public final class PrefixLines

/**
* Returns the prefix which will be added at the start of each input line.
*
*
* @return the prefix which will be added at the start of each input line
*/
private final String getPrefix() {
@@ -169,10 +169,10 @@ public final class PrefixLines
/**
* Creates a new PrefixLines filter using the passed in
* Reader for instantiation.
*
*
* @param rdr A Reader object providing the underlying stream.
* Must not be <code>null</code>.
*
*
* @return a new filter based on this configuration, but filtering
* the specified reader
*/


+ 26
- 26
src/main/org/apache/tools/ant/filters/ReplaceTokens.java View File

@@ -95,10 +95,10 @@ public final class ReplaceTokens

/** Index into replacement data */
private int replaceIndex = -1;
/** Index into queue data */
private int queueIndex = -1;
/** Hashtable to hold the replacee-replacer pairs (String to String). */
private Hashtable hash = new Hashtable();

@@ -110,7 +110,7 @@ public final class ReplaceTokens

/**
* Constructor for "dummy" instances.
*
*
* @see BaseFilterReader#BaseFilterReader()
*/
public ReplaceTokens() {
@@ -135,19 +135,19 @@ public final class ReplaceTokens
}
return ch;
}
return in.read();
}
/**
* Returns the next character in the filtered stream, replacing tokens
* from the original stream.
*
*
* @return the next character in the resulting stream, or -1
* if the end of the resulting stream has been reached
*
*
* @exception IOException if the underlying stream throws an IOException
* during reading
* during reading
*/
public final int read() throws IOException {
if (!getInitialized()) {
@@ -162,7 +162,7 @@ public final class ReplaceTokens
}
return ch;
}
int ch = getNextChar();

if (ch == beginToken) {
@@ -180,14 +180,14 @@ public final class ReplaceTokens
if (queuedData == null || queueIndex == -1) {
queuedData = key.toString();
} else {
queuedData
queuedData
= key.toString() + queuedData.substring(queueIndex);
}
queueIndex = 0;
return beginToken;
} else {
key.setLength(key.length() - 1);
final String replaceWith = (String) hash.get(key.toString());
if (replaceWith != null) {
if (replaceWith.length() > 0) {
@@ -212,7 +212,7 @@ public final class ReplaceTokens

/**
* Sets the "begin token" character.
*
*
* @param beginToken the character used to denote the beginning of a token
*/
public final void setBeginToken(final char beginToken) {
@@ -221,7 +221,7 @@ public final class ReplaceTokens

/**
* Returns the "begin token" character.
*
*
* @return the character used to denote the beginning of a token
*/
private final char getBeginToken() {
@@ -230,7 +230,7 @@ public final class ReplaceTokens

/**
* Sets the "end token" character.
*
*
* @param endToken the character used to denote the end of a token
*/
public final void setEndToken(final char endToken) {
@@ -239,7 +239,7 @@ public final class ReplaceTokens

/**
* Returns the "end token" character.
*
*
* @return the character used to denote the end of a token
*/
private final char getEndToken() {
@@ -248,7 +248,7 @@ public final class ReplaceTokens

/**
* Adds a token element to the map of tokens to replace.
*
*
* @param token The token to add to the map of replacements.
* Must not be <code>null</code>.
*/
@@ -258,7 +258,7 @@ public final class ReplaceTokens

/**
* Sets the map of tokens to replace.
*
*
* @param hash A map (String->String) of token keys to replacement
* values. Must not be <code>null</code>.
*/
@@ -268,7 +268,7 @@ public final class ReplaceTokens

/**
* Returns the map of tokens which will be replaced.
*
*
* @return a map (String->String) of token keys to replacement
* values
*/
@@ -279,10 +279,10 @@ public final class ReplaceTokens
/**
* Creates a new ReplaceTokens using the passed in
* Reader for instantiation.
*
*
* @param rdr A Reader object providing the underlying stream.
* Must not be <code>null</code>.
*
*
* @return a new filter based on this configuration, but filtering
* the specified reader
*/
@@ -309,13 +309,13 @@ public final class ReplaceTokens
String value = params[i].getValue();
if ("begintoken".equals(name)) {
if (value.length() == 0) {
throw new BuildException("Begin token cannot "
throw new BuildException("Begin token cannot "
+ "be empty");
}
beginToken = params[i].getValue().charAt(0);
} else if ("endtoken".equals(name)) {
if (value.length() == 0) {
throw new BuildException("End token cannot "
throw new BuildException("End token cannot "
+ "be empty");
}
endToken = params[i].getValue().charAt(0);
@@ -343,7 +343,7 @@ public final class ReplaceTokens

/**
* Sets the token key
*
*
* @param key The key for this token. Must not be <code>null</code>.
*/
public final void setKey(String key) {
@@ -352,7 +352,7 @@ public final class ReplaceTokens

/**
* Sets the token value
*
*
* @param value The value for this token. Must not be <code>null</code>.
*/
public final void setValue(String value) {
@@ -361,7 +361,7 @@ public final class ReplaceTokens

/**
* Returns the key for this token.
*
*
* @return the key for this token
*/
public final String getKey() {
@@ -370,7 +370,7 @@ public final class ReplaceTokens

/**
* Returns the value for this token.
*
*
* @return the value for this token
*/
public final String getValue() {


+ 10
- 10
src/main/org/apache/tools/ant/filters/StripLineBreaks.java View File

@@ -59,7 +59,7 @@ import org.apache.tools.ant.types.Parameter;

/**
* Filter to flatten the stream to a single line.
*
*
* Example:
*
* <pre>&lt;striplinebreaks/&gt;</pre>
@@ -88,7 +88,7 @@ public final class StripLineBreaks

/**
* Constructor for "dummy" instances.
*
*
* @see BaseFilterReader#BaseFilterReader()
*/
public StripLineBreaks() {
@@ -108,12 +108,12 @@ public final class StripLineBreaks
/**
* Returns the next character in the filtered stream, only including
* characters not in the set of line-breaking characters.
*
*
* @return the next character in the resulting stream, or -1
* if the end of the resulting stream has been reached
*
*
* @exception IOException if the underlying stream throws an IOException
* during reading
* during reading
*/
public final int read() throws IOException {
if (!getInitialized()) {
@@ -134,7 +134,7 @@ public final class StripLineBreaks

/**
* Sets the line-breaking characters.
*
*
* @param lineBreaks A String containing all the characters to be
* considered as line-breaking.
*/
@@ -144,8 +144,8 @@ public final class StripLineBreaks

/**
* Returns the line-breaking characters as a String.
*
* @return a String containing all the characters considered as
*
* @return a String containing all the characters considered as
* line-breaking
*/
private final String getLineBreaks() {
@@ -155,10 +155,10 @@ public final class StripLineBreaks
/**
* Creates a new StripLineBreaks using the passed in
* Reader for instantiation.
*
*
* @param rdr A Reader object providing the underlying stream.
* Must not be <code>null</code>.
*
*
* @return a new filter based on this configuration, but filtering
* the specified reader
*/


+ 13
- 13
src/main/org/apache/tools/ant/filters/StripLineComments.java View File

@@ -73,7 +73,7 @@ import org.apache.tools.ant.types.Parameter;
*
* Or:
*
* <pre>&lt;filterreader
* <pre>&lt;filterreader
* classname=&quot;org.apache.tools.ant.filters.StripLineComments&quot;&gt;
* &lt;param type=&quot;comment&quot; value="#&quot;/&gt;
* &lt;param type=&quot;comment&quot; value=&quot;--&quot;/&gt;
@@ -98,7 +98,7 @@ public final class StripLineComments

/**
* Constructor for "dummy" instances.
*
*
* @see BaseFilterReader#BaseFilterReader()
*/
public StripLineComments() {
@@ -117,14 +117,14 @@ public final class StripLineComments

/**
* Returns the next character in the filtered stream, only including
* lines from the original stream which don't start with any of the
* lines from the original stream which don't start with any of the
* specified comment prefixes.
*
*
* @return the next character in the resulting stream, or -1
* if the end of the resulting stream has been reached
*
*
* @exception IOException if the underlying stream throws an IOException
* during reading
* during reading
*/
public final int read() throws IOException {
if (!getInitialized()) {
@@ -172,7 +172,7 @@ public final class StripLineComments

/**
* Adds a <code>comment</code> element to the list of prefixes.
*
*
* @param comment The <code>comment</code> element to add to the
* list of comment prefixes to strip. Must not be <code>null</code>.
*/
@@ -182,7 +182,7 @@ public final class StripLineComments

/**
* Sets the list of comment prefixes to strip.
*
*
* @param comments A list of strings, each of which is a prefix
* for a comment line. Must not be <code>null</code>.
*/
@@ -192,7 +192,7 @@ public final class StripLineComments

/**
* Returns the list of comment prefixes to strip.
*
*
* @return the list of comment prefixes to strip.
*/
private final Vector getComments() {
@@ -202,10 +202,10 @@ public final class StripLineComments
/**
* Creates a new StripLineComments using the passed in
* Reader for instantiation.
*
*
* @param rdr A Reader object providing the underlying stream.
* Must not be <code>null</code>.
*
*
* @return a new filter based on this configuration, but filtering
* the specified reader
*/
@@ -240,7 +240,7 @@ public final class StripLineComments

/**
* Sets the prefix for this type of line comment.
*
*
* @param comment The prefix for a line comment of this type.
* Must not be <code>null</code>.
*/
@@ -250,7 +250,7 @@ public final class StripLineComments

/**
* Returns the prefix for this type of line comment.
*
*
* @return the prefix for this type of line comment.
*/
public final String getValue() {


+ 8
- 8
src/main/org/apache/tools/ant/filters/TabsToSpaces.java View File

@@ -89,7 +89,7 @@ public final class TabsToSpaces

/**
* Constructor for "dummy" instances.
*
*
* @see BaseFilterReader#BaseFilterReader()
*/
public TabsToSpaces() {
@@ -109,12 +109,12 @@ public final class TabsToSpaces
/**
* Returns the next character in the filtered stream, converting tabs
* to the specified number of spaces.
*
*
* @return the next character in the resulting stream, or -1
* if the end of the resulting stream has been reached
*
*
* @exception IOException if the underlying stream throws an IOException
* during reading
* during reading
*/
public final int read() throws IOException {
if (!getInitialized()) {
@@ -139,7 +139,7 @@ public final class TabsToSpaces

/**
* Sets the tab length.
*
*
* @param tabLength the number of spaces to be used when converting a tab.
*/
public final void setTablength(final int tabLength) {
@@ -148,7 +148,7 @@ public final class TabsToSpaces

/**
* Returns the tab length.
*
*
* @return the number of spaces used when converting a tab
*/
private final int getTablength() {
@@ -158,10 +158,10 @@ public final class TabsToSpaces
/**
* Creates a new TabsToSpaces using the passed in
* Reader for instantiation.
*
*
* @param rdr A Reader object providing the underlying stream.
* Must not be <code>null</code>.
*
*
* @return a new filter based on this configuration, but filtering
* the specified reader
*/


+ 2
- 2
src/main/org/apache/tools/ant/filters/TailFilter.java View File

@@ -99,14 +99,14 @@ public final class TailFilter

/** A line tokenizer */
private TokenFilter.LineTokenizer lineTokenizer = null;
/** the current line from the input stream */
private String line = null;
/** the position in the current line */
private int linePos = 0;

private LinkedList lineList = new LinkedList();
/**
* Constructor for "dummy" instances.
*


+ 13
- 13
src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java View File

@@ -77,17 +77,17 @@ import org.apache.tools.ant.util.StringUtils;
*
* @author costin@dnt.ro
* @author stefano@apache.org
* @author Wolfgang Werner
* @author Wolfgang Werner
* <a href="mailto:wwerner@picturesafe.de">wwerner@picturesafe.de</a>
* @author Kevin Ross
* @author Kevin Ross
* <a href="mailto:kevin.ross@bredex.com">kevin.ross@bredex.com</a>
*
* @since Ant 1.5
*/
public abstract class AbstractCvsTask extends Task {
/**
/**
* Default compression level to use, if compression is enabled via
* setCompression( true ).
* setCompression( true ).
*/
public static final int DEFAULT_COMPRESSION_LEVEL = 3;

@@ -189,7 +189,7 @@ public abstract class AbstractCvsTask extends Task {
protected ExecuteStreamHandler getExecuteStreamHandler() {

if (this.executeStreamHandler == null) {
setExecuteStreamHandler(new PumpStreamHandler(getOutputStream(),
setExecuteStreamHandler(new PumpStreamHandler(getOutputStream(),
getErrorStream()));
}

@@ -211,7 +211,7 @@ public abstract class AbstractCvsTask extends Task {
setOutputStream(new PrintStream(
new BufferedOutputStream(
new FileOutputStream(output
.getPath(),
.getPath(),
append))));
} catch (IOException e) {
throw new BuildException(e, getLocation());
@@ -280,7 +280,7 @@ public abstract class AbstractCvsTask extends Task {

File defaultPassFile = new File(
System.getProperty("cygwin.user.home",
System.getProperty("user.home"))
System.getProperty("user.home"))
+ File.separatorChar + ".cvspass");

if(defaultPassFile.exists()) {
@@ -294,7 +294,7 @@ public abstract class AbstractCvsTask extends Task {
var.setKey("CVS_PASSFILE");
var.setValue(String.valueOf(passFile));
env.addVariable(var);
log("Using cvs passfile: " + String.valueOf(passFile),
log("Using cvs passfile: " + String.valueOf(passFile),
Project.MSG_INFO);
} else if (!passFile.canRead()) {
log("cvs passfile: " + String.valueOf(passFile)
@@ -341,7 +341,7 @@ public abstract class AbstractCvsTask extends Task {
/*Throw an exception if cvs exited with error. (Iulian)*/
if (failOnError && retCode != 0) {
throw new BuildException("cvs exited with error code "
+ retCode
+ retCode
+ StringUtils.LINE_SEP
+ "Command line was ["
+ actualCommandLine + "]", getLocation());
@@ -413,7 +413,7 @@ public abstract class AbstractCvsTask extends Task {

private String executeToString(Execute execute){

StringBuffer stringBuffer =
StringBuffer stringBuffer =
new StringBuffer(Commandline.describeCommand(execute
.getCommandline()));

@@ -674,10 +674,10 @@ public abstract class AbstractCvsTask extends Task {
* Configures and adds the given Commandline.
* @param insertAtStart If true, c is
*/
public void addConfiguredCommandline(Commandline c,
public void addConfiguredCommandline(Commandline c,
boolean insertAtStart) {
if (c == null) {
return;
return;
}
this.configureCommandline(c);
if (insertAtStart) {
@@ -702,7 +702,7 @@ public abstract class AbstractCvsTask extends Task {
* level, AbstractCvsTask.DEFAULT_COMPRESSION_LEVEL.
*/
public void setCompression(boolean usecomp) {
setCompressionLevel(usecomp ?
setCompressionLevel(usecomp ?
AbstractCvsTask.DEFAULT_COMPRESSION_LEVEL : 0);
}



+ 8
- 8
src/main/org/apache/tools/ant/taskdefs/Ant.java View File

@@ -273,10 +273,10 @@ public class Ant extends Task {

/**
* @see Task#handleInput(byte[], int, int)
*
*
* @since Ant 1.6
*/
public int handleInput(byte[] buffer, int offset, int length)
public int handleInput(byte[] buffer, int offset, int length)
throws IOException {
if (newProject != null) {
return newProject.demuxInput(buffer, offset, length);
@@ -284,7 +284,7 @@ public class Ant extends Task {
return super.handleInput(buffer, offset, length);
}
}
/**
* Pass output sent to System.out to the new project.
*
@@ -371,7 +371,7 @@ public class Ant extends Task {
target = newProject.getDefaultTarget();
}

// Are we trying to call the target in which we are defined (or
// Are we trying to call the target in which we are defined (or
// the build file if this is a top level task)?
if (newProject.getBaseDir().equals(getProject().getBaseDir()) &&
newProject.getProperty("ant.file").equals(getProject().getProperty("ant.file"))
@@ -432,7 +432,7 @@ public class Ant extends Task {
* requested.
*/
private void addReferences() throws BuildException {
Hashtable thisReferences
Hashtable thisReferences
= (Hashtable) getProject().getReferences().clone();
Hashtable newReferences = newProject.getReferences();
Enumeration e;
@@ -484,8 +484,8 @@ public class Ant extends Task {
private void copyReference(String oldKey, String newKey) {
Object orig = getProject().getReference(oldKey);
if (orig == null) {
log("No object referenced by " + oldKey + ". Can't copy to "
+ newKey,
log("No object referenced by " + oldKey + ". Can't copy to "
+ newKey,
Project.MSG_WARN);
return;
}
@@ -579,7 +579,7 @@ public class Ant extends Task {
if (s.equals("")) {
throw new BuildException("target attribute must not be empty");
}
this.target = s;
}



+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Basename.java View File

@@ -130,7 +130,7 @@ public class Basename extends Task {
// char preceding the suffix is a '.', we assume the user
// wants to remove the '.' as well (see docs)
int pos = value.length() - suffix.length();
if (pos > 0 && suffix.charAt(0) != '.'
if (pos > 0 && suffix.charAt(0) != '.'
&& value.charAt(pos - 1) == '.') {
pos--;
}


+ 9
- 9
src/main/org/apache/tools/ant/taskdefs/CallTarget.java View File

@@ -78,7 +78,7 @@ import java.io.IOException;
* defined in the project itself.
*
*
* @author Stefan Bodewig
* @author Stefan Bodewig
*
* @since Ant 1.2
*
@@ -131,12 +131,12 @@ public class CallTarget extends Task {
if (callee == null) {
init();
}
if (subTarget == null) {
throw new BuildException("Attribute target is required.",
throw new BuildException("Attribute target is required.",
getLocation());
}
callee.setAntfile(getProject().getProperty("ant.file"));
callee.setTarget(subTarget);
callee.setInheritAll(inheritAll);
@@ -197,13 +197,13 @@ public class CallTarget extends Task {
super.handleOutput(line);
}
}
/**
* @see Task#handleInput(byte[], int, int)
*
*
* @since Ant 1.6
*/
public int handleInput(byte[] buffer, int offset, int length)
public int handleInput(byte[] buffer, int offset, int length)
throws IOException {
if (callee != null) {
return callee.handleInput(buffer, offset, length);
@@ -224,7 +224,7 @@ public class CallTarget extends Task {
super.handleFlush(line);
}
}
/**
* Pass output sent to System.err to the new project.
*
@@ -237,7 +237,7 @@ public class CallTarget extends Task {
super.handleErrorOutput(line);
}
}
/**
* Pass output sent to System.err to the new project.
*


+ 20
- 20
src/main/org/apache/tools/ant/taskdefs/Concat.java View File

@@ -111,7 +111,7 @@ public class Concat extends Task {
private File destinationFile = null;

/**
* Whether or not the stream should be appended if the destination file
* Whether or not the stream should be appended if the destination file
* exists.
* Defaults to <code>false</code>.
*/
@@ -311,11 +311,11 @@ public class Concat extends Task {
public void setWriter(Writer outputWriter) {
this.outputWriter = outputWriter;
}
/**
* This method performs the concatenation.
*/
public void execute()
public void execute()
throws BuildException {

// treat empty nested text as no text
@@ -325,12 +325,12 @@ public class Concat extends Task {
throw new BuildException(
"Cannot specify both a destination file and an output writer");
}
// Sanity check our inputs.
if (sources.size() == 0 && textBuffer == null) {
// Nothing to concatenate!
throw new BuildException("At least one file " +
"must be provided, or " +
throw new BuildException("At least one file " +
"must be provided, or " +
"some text.");
}

@@ -338,7 +338,7 @@ public class Concat extends Task {
// using GNU 'cat' with file arguments -- stdin is simply
// ignored.
if (sources.size() > 0 && textBuffer != null) {
throw new BuildException("Cannot include inline text " +
throw new BuildException("Cannot include inline text " +
"when using filesets.");
}

@@ -382,9 +382,9 @@ public class Concat extends Task {

// Do nothing if all the sources are not present
// And textBuffer is null
if (textBuffer == null && sourceFiles.size() == 0
if (textBuffer == null && sourceFiles.size() == 0
&& header == null && footer == null) {
log("No existing files and no nested text, doing nothing",
log("No existing files and no nested text, doing nothing",
Project.MSG_INFO);
return;
}
@@ -416,16 +416,16 @@ public class Concat extends Task {
log("File " + file + " does not exist.", Project.MSG_ERR);
continue;
}
if (destinationFile != null
if (destinationFile != null
&& fileUtils.fileNameEquals(destinationFile, file)) {
throw new BuildException("Input file \""
throw new BuildException("Input file \""
+ file + "\" "
+ "is the same as the output file.");
}
sourceFiles.addElement(file);
}
}
/** perform the concatenation */
private void cat() {
OutputStream os = null;
@@ -479,7 +479,7 @@ public class Concat extends Task {
} else {
reader = new MultiReader();
}
concatenate(buffer, writer, reader);

if (footer != null) {
@@ -521,7 +521,7 @@ public class Concat extends Task {
helper.setProject(getProject());
in = new BufferedReader(helper.getAssembledReader());
}
while (true) {
int nRead = in.read(buffer, 0, buffer.length);
if (nRead == -1) {
@@ -529,7 +529,7 @@ public class Concat extends Task {
}
writer.write(buffer, 0, nRead);
}
writer.flush();
}

@@ -567,7 +567,7 @@ public class Concat extends Task {
public void setFiltering(boolean filtering) {
this.filtering = filtering;
}
/** return the filtering attribute */
private boolean getFiltering() {
return filtering;
@@ -576,7 +576,7 @@ public class Concat extends Task {
public void setEncoding(String encoding) {
this.encoding = encoding;
}
/**
* set the text using a file
* @param file the file to use
@@ -681,7 +681,7 @@ public class Concat extends Task {
private int lastPos = 0;
private char[] lastChars = new char[eolString.length()];
private boolean needAddSeparator = false;
private Reader getReader() throws IOException {
if (reader == null) {
if (encoding == null) {
@@ -718,7 +718,7 @@ public class Concat extends Task {
}
return ret;
}
while (pos < sourceFiles.size()) {
int ch = getReader().read();
if (ch == -1) {
@@ -732,7 +732,7 @@ public class Concat extends Task {
addLastChar((char) ch);
return ch;
}
pos++;
pos++;
}
return -1;
}


+ 6
- 6
src/main/org/apache/tools/ant/taskdefs/Copy.java View File

@@ -378,7 +378,7 @@ public class Copy extends Task {
try {
ds = fs.getDirectoryScanner(getProject());
} catch (BuildException e) {
if (failonerror
if (failonerror
|| !e.getMessage().endsWith(" not found.")) {
throw e;
} else {
@@ -386,7 +386,7 @@ public class Copy extends Task {
continue;
}
}
File fromDir = fs.getDir(getProject());

String[] srcFiles = ds.getIncludedFiles();
@@ -440,20 +440,20 @@ public class Copy extends Task {
throw new BuildException("Specify at least one source "
+ "- a file or a fileset.");
}
if (destFile != null && destDir != null) {
throw new BuildException("Only one of tofile and todir "
+ "may be set.");
}
if (destFile == null && destDir == null) {
throw new BuildException("One of tofile or todir must be set.");
}
if (file != null && file.exists() && file.isDirectory()) {
throw new BuildException("Use a fileset to copy directories.");
}
if (destFile != null && filesets.size() > 0) {
if (filesets.size() > 1) {
throw new BuildException(


+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/Copydir.java View File

@@ -105,7 +105,7 @@ public class Copydir extends MatchingTask {
log("DEPRECATED - The copydir task is deprecated. Use copy instead.");

if (srcDir == null) {
throw new BuildException("src attribute must be set!",
throw new BuildException("src attribute must be set!",
getLocation());
}

@@ -115,7 +115,7 @@ public class Copydir extends MatchingTask {
}

if (destDir == null) {
throw new BuildException("The dest attribute must be set.",
throw new BuildException("The dest attribute must be set.",
getLocation());
}

@@ -140,7 +140,7 @@ public class Copydir extends MatchingTask {
getProject().copyFile(fromFile, toFile, filtering,
forceOverwrite);
} catch (IOException ioe) {
String msg = "Failed to copy " + fromFile + " to "
String msg = "Failed to copy " + fromFile + " to "
+ toFile + " due to " + ioe.getMessage();
throw new BuildException(msg, ioe, getLocation());
}


+ 5
- 5
src/main/org/apache/tools/ant/taskdefs/Copyfile.java View File

@@ -77,7 +77,7 @@ public class Copyfile extends Task {
private File destFile;
private boolean filtering = false;
private boolean forceOverwrite = false;
public void setSrc(File src) {
srcFile = src;
}
@@ -98,17 +98,17 @@ public class Copyfile extends Task {
log("DEPRECATED - The copyfile task is deprecated. Use copy instead.");

if (srcFile == null) {
throw new BuildException("The src attribute must be present.",
throw new BuildException("The src attribute must be present.",
getLocation());
}
if (!srcFile.exists()) {
throw new BuildException("src " + srcFile.toString()
+ " does not exist.", getLocation());
}

if (destFile == null) {
throw new BuildException("The dest attribute must be present.",
throw new BuildException("The dest attribute must be present.",
getLocation());
}

@@ -116,7 +116,7 @@ public class Copyfile extends Task {
log("Warning: src == dest", Project.MSG_WARN);
}

if (forceOverwrite
if (forceOverwrite
|| srcFile.lastModified() > destFile.lastModified()) {
try {
getProject().copyFile(srcFile, destFile, filtering, forceOverwrite);


+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/Cvs.java View File

@@ -65,13 +65,13 @@ package org.apache.tools.ant.taskdefs;
*
* @author costin@dnt.ro
* @author stefano@apache.org
* @author Wolfgang Werner
* @author Wolfgang Werner
* <a href="mailto:wwerner@picturesafe.de">wwerner@picturesafe.de</a>
* @author Kevin Ross
* @author Kevin Ross
* <a href="mailto:kevin.ross@bredex.com">kevin.ross@bredex.com</a>
*
* @since Ant 1.1
*
*
* @ant.task category="scm"
*/
public class Cvs extends AbstractCvsTask {


+ 23
- 23
src/main/org/apache/tools/ant/taskdefs/Delete.java View File

@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -80,18 +80,18 @@ import org.apache.tools.ant.types.selectors.FileSelector;

/**
* Deletes a file or directory, or set of files defined by a fileset.
* The original delete task would delete a file, or a set of files
* using the include/exclude syntax. The deltree task would delete a
* The original delete task would delete a file, or a set of files
* using the include/exclude syntax. The deltree task would delete a
* directory tree. This task combines the functionality of these two
* originally distinct tasks.
* <p>Currently Delete extends MatchingTask. This is intend <i>only</i>
* to provide backwards compatibility for a release. The future position
* is to use nested filesets exclusively.</p>
*
* @author Stefano Mazzocchi
*
* @author Stefano Mazzocchi
* <a href="mailto:stefano@apache.org">stefano@apache.org</a>
* @author Tom Dimock <a href="mailto:tad1@cornell.edu">tad1@cornell.edu</a>
* @author Glenn McAllister
* @author Glenn McAllister
* <a href="mailto:glennm@ca.ibm.com">glennm@ca.ibm.com</a>
* @author Jon S. Stevens <a href="mailto:jon@latchkey.com">jon@latchkey.com</a>
*
@@ -197,7 +197,7 @@ public class Delete extends MatchingTask {
usedMatchingTask = true;
return super.createIncludesFile();
}
/**
* add a name entry on the exclude list
*/
@@ -213,7 +213,7 @@ public class Delete extends MatchingTask {
usedMatchingTask = true;
return super.createExcludesFile();
}
/**
* add a set of patterns
*/
@@ -410,7 +410,7 @@ public class Delete extends MatchingTask {
usedMatchingTask = true;
super.addDepend(selector);
}
/**
* add a regular expression selector entry on the selector list
*/
@@ -447,38 +447,38 @@ public class Delete extends MatchingTask {
throw new BuildException("quiet and failonerror cannot both be "
+ "set to true", getLocation());
}

// delete the single file
if (file != null) {
if (file.exists()) {
if (file.isDirectory()) {
log("Directory " + file.getAbsolutePath()
log("Directory " + file.getAbsolutePath()
+ " cannot be removed using the file attribute. "
+ "Use dir instead.");
} else {
log("Deleting: " + file.getAbsolutePath());

if (!file.delete()) {
String message = "Unable to delete file "
String message = "Unable to delete file "
+ file.getAbsolutePath();
if (failonerror) {
throw new BuildException(message);
} else {
log(message, quiet ? Project.MSG_VERBOSE
} else {
log(message, quiet ? Project.MSG_VERBOSE
: Project.MSG_WARN);
}
}
}
} else {
log("Could not find file " + file.getAbsolutePath()
+ " to delete.",
log("Could not find file " + file.getAbsolutePath()
+ " to delete.",
Project.MSG_VERBOSE);
}
}

// delete the directory
if (dir != null && dir.exists() && dir.isDirectory() &&
if (dir != null && dir.exists() && dir.isDirectory() &&
!usedMatchingTask) {
/*
If verbosity is MSG_VERBOSE, that mean we are doing
@@ -506,7 +506,7 @@ public class Delete extends MatchingTask {
if (failonerror) {
throw be;
} else {
log(be.getMessage(),
log(be.getMessage(),
quiet ? Project.MSG_VERBOSE : Project.MSG_WARN);
}
}
@@ -524,7 +524,7 @@ public class Delete extends MatchingTask {
if (failonerror) {
throw be;
} else {
log(be.getMessage(),
log(be.getMessage(),
quiet ? Project.MSG_VERBOSE : Project.MSG_WARN);
}
}
@@ -548,7 +548,7 @@ public class Delete extends MatchingTask {
} else {
log("Deleting " + f.getAbsolutePath(), verbosity);
if (!f.delete()) {
String message = "Unable to delete file "
String message = "Unable to delete file "
+ f.getAbsolutePath();
if (failonerror) {
throw new BuildException(message);
@@ -561,7 +561,7 @@ public class Delete extends MatchingTask {
}
log("Deleting directory " + d.getAbsolutePath(), verbosity);
if (!d.delete()) {
String message = "Unable to delete directory "
String message = "Unable to delete directory "
+ dir.getAbsolutePath();
if (failonerror) {
throw new BuildException(message);
@@ -581,13 +581,13 @@ public class Delete extends MatchingTask {
*/
protected void removeFiles(File d, String[] files, String[] dirs) {
if (files.length > 0) {
log("Deleting " + files.length + " files from "
log("Deleting " + files.length + " files from "
+ d.getAbsolutePath());
for (int j = 0; j < files.length; j++) {
File f = new File(d, files[j]);
log("Deleting " + f.getAbsolutePath(), verbosity);
if (!f.delete()) {
String message = "Unable to delete file "
String message = "Unable to delete file "
+ f.getAbsolutePath();
if (failonerror) {
throw new BuildException(message);


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/Deltree.java View File

@@ -135,13 +135,13 @@ public class Deltree extends Task {
removeDir(f);
} else {
if (!f.delete()) {
throw new BuildException("Unable to delete file "
throw new BuildException("Unable to delete file "
+ f.getAbsolutePath());
}
}
}
if (!dir.delete()) {
throw new BuildException("Unable to delete directory "
throw new BuildException("Unable to delete directory "
+ dir.getAbsolutePath());
}
}


+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/Ear.java View File

@@ -99,8 +99,8 @@ public class Ear extends Jar {
public void setAppxml(File descr) {
deploymentDescriptor = descr;
if (!deploymentDescriptor.exists()) {
throw new BuildException("Deployment descriptor: "
+ deploymentDescriptor
throw new BuildException("Deployment descriptor: "
+ deploymentDescriptor
+ " does not exist.");
}

@@ -138,7 +138,7 @@ public class Ear extends Jar {
/**
* Overriden from Zip class to deal with application.xml
*/
protected void zipFile(File file, ZipOutputStream zOut, String vPath,
protected void zipFile(File file, ZipOutputStream zOut, String vPath,
int mode)
throws IOException {
// If the file being added is META-INF/application.xml, we
@@ -147,7 +147,7 @@ public class Ear extends Jar {
// file is specified by the "appxml" attribute and in a
// <fileset> element.
if (vPath.equalsIgnoreCase("META-INF/application.xml")) {
if (deploymentDescriptor == null
if (deploymentDescriptor == null
|| !fu.fileNameEquals(deploymentDescriptor, file)
|| descriptorAdded) {
log("Warning: selected " + archiveType


+ 5
- 5
src/main/org/apache/tools/ant/taskdefs/Echo.java View File

@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -74,10 +74,10 @@ public class Echo extends Task {
protected String message = ""; // required
protected File file = null;
protected boolean append = false;
// by default, messages are always displayed
protected int logLevel = Project.MSG_WARN;
protected int logLevel = Project.MSG_WARN;
/**
* Does the work.
*
@@ -166,7 +166,7 @@ public class Echo extends Task {
* @see EnumeratedAttribute#getValues
*/
public String[] getValues() {
return new String[] {"error", "warning", "info",
return new String[] {"error", "warning", "info",
"verbose", "debug"};
}
}


+ 6
- 6
src/main/org/apache/tools/ant/taskdefs/Exec.java View File

@@ -76,7 +76,7 @@ import org.apache.tools.ant.Task;
* @author duncan@x180.com
* @author rubys@us.ibm.com
*
* @deprecated delegate to {@link org.apache.tools.ant.taskdefs.Execute Execute}
* @deprecated delegate to {@link org.apache.tools.ant.taskdefs.Execute Execute}
* instead.
*/
public class Exec extends Task {
@@ -88,9 +88,9 @@ public class Exec extends Task {
private boolean failOnError = false;

public Exec() {
System.err.println("As of Ant 1.2 released in October 2000, "
System.err.println("As of Ant 1.2 released in October 2000, "
+ "the Exec class");
System.err.println("is considered to be dead code by the Ant "
System.err.println("is considered to be dead code by the Ant "
+ "developers and is unmaintained.");
System.err.println("Don\'t use it!");
}
@@ -124,10 +124,10 @@ public class Exec extends Task {
} else {
String ant = getProject().getProperty("ant.home");
if (ant == null) {
throw new BuildException("Property 'ant.home' not "
throw new BuildException("Property 'ant.home' not "
+ "found", getLocation());
}
String antRun = getProject().resolveFile(ant + "/bin/antRun.bat").toString();
command = antRun + " " + dir + " " + command;
}
@@ -212,7 +212,7 @@ public class Exec extends Task {

protected void outputLog(String line, int messageLevel) {
if (fos == null) {
log(line, messageLevel);
log(line, messageLevel);
} else {
fos.println(line);
}


+ 15
- 15
src/main/org/apache/tools/ant/taskdefs/ExecTask.java View File

@@ -79,7 +79,7 @@ import org.apache.tools.ant.util.FileUtils;
public class ExecTask extends Task {

private String os;
private File dir;
protected boolean failOnError = false;
protected boolean newEnvironment = false;
@@ -92,7 +92,7 @@ public class ExecTask extends Task {
private boolean resolveExecutable = false;

private Redirector redirector = new Redirector(this);
/**
* Controls whether the VM (1.3 and above) is used to execute the
* command
@@ -152,7 +152,7 @@ public class ExecTask extends Task {
}

/**
* File the output of the process is redirected to. If error is not
* File the output of the process is redirected to. If error is not
* redirected, it too will appear in the output
*/
public void setOutput(File out) {
@@ -174,7 +174,7 @@ public class ExecTask extends Task {
public void setInputString(String inputString) {
redirector.setInputString(inputString);
}
/**
* Controls whether error output of exec is logged. This is only useful
* when output is being redirected and error output is desired in the
@@ -183,7 +183,7 @@ public class ExecTask extends Task {
public void setLogError(boolean logError) {
redirector.setLogError(logError);
}
/**
* File the error stream of the process is redirected to.
*
@@ -231,7 +231,7 @@ public class ExecTask extends Task {
public void setResolveExecutable(boolean resolveExecutable) {
this.resolveExecutable = resolveExecutable;
}
/**
* Add an environment variable to the launched process.
*/
@@ -286,10 +286,10 @@ public class ExecTask extends Task {
redirector.setAppend(append);
}

/**
* Attempt to figure out where the executable is so that we can feed
* Attempt to figure out where the executable is so that we can feed
* the full path - first try basedir, then the exec dir and then
* fallback to the straight executable name (i.e. on ther path)
*
@@ -299,13 +299,13 @@ public class ExecTask extends Task {
if (!resolveExecutable) {
return executable;
}
// try to find the executable
File executableFile = getProject().resolveFile(executable);
if (executableFile.exists()) {
return executableFile.getAbsolutePath();
}
// now try to resolve against the dir if given
if (dir != null) {
FileUtils fileUtils = FileUtils.newFileUtils();
@@ -316,9 +316,9 @@ public class ExecTask extends Task {
}

// couldn't find it - must be on path
return executable;
return executable;
}
/**
* Do the work.
*/
@@ -372,7 +372,7 @@ public class ExecTask extends Task {
/**
* If true, launch new process with VM, otherwise use the OS's shell.
*/
public void setVMLauncher(boolean vmLauncher) {
public void setVMLauncher(boolean vmLauncher) {
this.vmLauncher = vmLauncher;
}

@@ -415,7 +415,7 @@ public class ExecTask extends Task {
maybeSetResultPropertyValue(returnCode);
if (returnCode != 0) {
if (failOnError) {
throw new BuildException(getTaskType() + " returned: "
throw new BuildException(getTaskType() + " returned: "
+ returnCode, getLocation());
} else {
log("Result: " + returnCode, Project.MSG_ERR);


+ 34
- 34
src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java View File

@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -72,9 +72,9 @@ import org.apache.tools.ant.util.FileNameMapper;
import org.apache.tools.ant.util.SourceFileScanner;

/**
* Executes a given command, supplying a set of files as arguments.
* Executes a given command, supplying a set of files as arguments.
*
* @author Stefan Bodewig
* @author Stefan Bodewig
* @author <a href="mailto:mariusz@rakiura.org">Mariusz Nowostawski</a>
*
* @since Ant 1.2
@@ -120,7 +120,7 @@ public class ExecuteOn extends ExecTask {
* @since Ant 1.6
*/
public void addDirset(DirSet set) {
filesets.addElement(set);
filesets.addElement(set);
}
/**
* Source files to operate upon.
@@ -257,21 +257,21 @@ public class ExecuteOn extends ExecTask {
if ("execon".equals(getTaskName())) {
log("!! execon is deprecated. Use apply instead. !!");
}
super.checkConfiguration();
if (filesets.size() == 0 && filelists.size() == 0) {
throw new BuildException("no filesets and no filelists specified",
getLocation());
}

if (targetFilePos != null || mapperElement != null
if (targetFilePos != null || mapperElement != null
|| destDir != null) {

if (mapperElement == null) {
throw new BuildException("no mapper specified", getLocation());
}
if (destDir == null) {
throw new BuildException("no dest attribute specified",
throw new BuildException("no dest attribute specified",
getLocation());
}
mapper = mapperElement.getImplementation();
@@ -291,7 +291,7 @@ public class ExecuteOn extends ExecTask {
AbstractFileSet fs = (AbstractFileSet) filesets.elementAt(i);
if (fs instanceof DirSet) {
if (!"dir".equals(type)) {
log("Found a nested dirset but type is " + type + ". "
log("Found a nested dirset but type is " + type + ". "
+ "Temporarily switching to type=\"dir\" on the" +
" assumption that you really did mean" +
" <dirset> not <fileset>.", Project.MSG_DEBUG);
@@ -330,7 +330,7 @@ public class ExecuteOn extends ExecTask {
fileNames.copyInto(s);
for (int j = 0; j < s.length; j++) {
String[] command = getCommandline(s[j], base);
log(Commandline.describeCommand(command),
log(Commandline.describeCommand(command),
Project.MSG_VERBOSE);
exe.setCommandline(command);
runExecute(exe);
@@ -373,7 +373,7 @@ public class ExecuteOn extends ExecTask {
fileNames.copyInto(s);
for (int j = 0; j < s.length; j++) {
String[] command = getCommandline(s[j], base);
log(Commandline.describeCommand(command),
log(Commandline.describeCommand(command),
Project.MSG_VERBOSE);
exe.setCommandline(command);
runExecute(exe);
@@ -440,13 +440,13 @@ public class ExecuteOn extends ExecTask {
}
String[] targetFiles = new String[targets.size()];
targets.copyInto(targetFiles);
if (!addSourceFile) {
srcFiles = new String[0];
}

String[] orig = cmdl.getCommandline();
String[] result
String[] result
= new String[orig.length + srcFiles.length + targetFiles.length];

int srcIndex = orig.length;
@@ -457,42 +457,42 @@ public class ExecuteOn extends ExecTask {
if (targetFilePos != null) {
int targetIndex = targetFilePos.getPosition();

if (srcIndex < targetIndex
if (srcIndex < targetIndex
|| (srcIndex == targetIndex && srcIsFirst)) {

// 0 --> srcIndex
System.arraycopy(orig, 0, result, 0, srcIndex);
// srcIndex --> targetIndex
System.arraycopy(orig, srcIndex, result,
System.arraycopy(orig, srcIndex, result,
srcIndex + srcFiles.length,
targetIndex - srcIndex);
// targets are already absolute file names
System.arraycopy(targetFiles, 0, result,
targetIndex + srcFiles.length,
System.arraycopy(targetFiles, 0, result,
targetIndex + srcFiles.length,
targetFiles.length);
// targetIndex --> end
System.arraycopy(orig, targetIndex, result,
System.arraycopy(orig, targetIndex, result,
targetIndex + srcFiles.length + targetFiles.length,
orig.length - targetIndex);
} else {
// 0 --> targetIndex
System.arraycopy(orig, 0, result, 0, targetIndex);
// targets are already absolute file names
System.arraycopy(targetFiles, 0, result,
System.arraycopy(targetFiles, 0, result,
targetIndex,
targetFiles.length);
// targetIndex --> srcIndex
System.arraycopy(orig, targetIndex, result,
System.arraycopy(orig, targetIndex, result,
targetIndex + targetFiles.length,
srcIndex - targetIndex);
// srcIndex --> end
System.arraycopy(orig, srcIndex, result,
System.arraycopy(orig, srcIndex, result,
srcIndex + srcFiles.length + targetFiles.length,
orig.length - srcIndex);
srcIndex += targetFiles.length;
@@ -503,7 +503,7 @@ public class ExecuteOn extends ExecTask {
// 0 --> srcIndex
System.arraycopy(orig, 0, result, 0, srcIndex);
// srcIndex --> end
System.arraycopy(orig, srcIndex, result,
System.arraycopy(orig, srcIndex, result,
srcIndex + srcFiles.length,
orig.length - srcIndex);

@@ -512,13 +512,13 @@ public class ExecuteOn extends ExecTask {
// fill in source file names
for (int i = 0; i < srcFiles.length; i++) {
if (!relative) {
result[srcIndex + i] =
result[srcIndex + i] =
(new File(baseDirs[i], srcFiles[i])).getAbsolutePath();
} else {
result[srcIndex + i] = srcFiles[i];
}
if (forwardSlash && fileSeparator != '/') {
result[srcIndex + i] =
result[srcIndex + i] =
result[srcIndex + i].replace(fileSeparator, '/');
}
}
@@ -542,7 +542,7 @@ public class ExecuteOn extends ExecTask {
protected String[] getFiles(File baseDir, DirectoryScanner ds) {
if (mapper != null) {
SourceFileScanner sfs = new SourceFileScanner(this);
return sfs.restrict(ds.getIncludedFiles(), baseDir, destDir,
return sfs.restrict(ds.getIncludedFiles(), baseDir, destDir,
mapper);
} else {
return ds.getIncludedFiles();
@@ -556,7 +556,7 @@ public class ExecuteOn extends ExecTask {
protected String[] getDirs(File baseDir, DirectoryScanner ds) {
if (mapper != null) {
SourceFileScanner sfs = new SourceFileScanner(this);
return sfs.restrict(ds.getIncludedDirectories(), baseDir, destDir,
return sfs.restrict(ds.getIncludedDirectories(), baseDir, destDir,
mapper);
} else {
return ds.getIncludedDirectories();
@@ -569,7 +569,7 @@ public class ExecuteOn extends ExecTask {
*
* @since Ant 1.6
*/
protected void runParallel(Execute exe, Vector fileNames,
protected void runParallel(Execute exe, Vector fileNames,
Vector baseDirs)
throws IOException, BuildException {
String[] s = new String[fileNames.size()];
@@ -577,7 +577,7 @@ public class ExecuteOn extends ExecTask {
File[] b = new File[baseDirs.size()];
baseDirs.copyInto(b);

if (maxParallel <= 0
if (maxParallel <= 0
|| s.length == 0 /* this is skipEmpty == false */) {
String[] command = getCommandline(s, b);
log(Commandline.describeCommand(command), Project.MSG_VERBOSE);
@@ -605,7 +605,7 @@ public class ExecuteOn extends ExecTask {

/**
* Enumerated attribute with the values "file", "dir" and "both"
* for the type attribute.
* for the type attribute.
*/
public static class FileDirBoth extends EnumeratedAttribute {
/**


+ 11
- 11
src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java View File

@@ -70,7 +70,7 @@ import org.apache.tools.ant.util.Watchdog;
* // it was killed on purpose by the watchdog
* }
* </pre>
* @author thomas.haas@softwired-inc.com
* @author <a href="mailto:sbailliez_at_apache.org">Stephane Bailliez</a>
* @see Execute
@@ -78,13 +78,13 @@ import org.apache.tools.ant.util.Watchdog;
* @since Ant 1.2
*/
public class ExecuteWatchdog implements TimeoutObserver {
/** the process to execute and watch for duration */
private Process process;

/** say whether or not the watchog is currently monitoring a process */
private boolean watch = false;
/** exception that might be thrown during the process execution */
private Exception caught = null;

@@ -97,7 +97,7 @@ public class ExecuteWatchdog implements TimeoutObserver {
/**
* Creates a new watchdog with a given timeout.
*
* @param timeout the timeout for the process in milliseconds.
* @param timeout the timeout for the process in milliseconds.
* It must be greather than 0.
*/
public ExecuteWatchdog(long timeout) {
@@ -135,7 +135,7 @@ public class ExecuteWatchdog implements TimeoutObserver {
}

/**
* Stops the watcher. It will notify all threads possibly waiting
* Stops the watcher. It will notify all threads possibly waiting
* on this object.
*/
public synchronized void stop() {
@@ -177,11 +177,11 @@ public class ExecuteWatchdog implements TimeoutObserver {
}

/**
* This method will rethrow the exception that was possibly caught during
* the run of the process. It will only remains valid once the process has
* been terminated either by 'error', timeout or manual intervention.
* This method will rethrow the exception that was possibly caught during
* the run of the process. It will only remains valid once the process has
* been terminated either by 'error', timeout or manual intervention.
* Information will be discarded once a new process is ran.
* @throws BuildException a wrapped exception over the one that was
* @throws BuildException a wrapped exception over the one that was
* silently swallowed and stored during the process run.
*/
public void checkException() throws BuildException {
@@ -193,7 +193,7 @@ public class ExecuteWatchdog implements TimeoutObserver {

/**
* Indicates whether or not the watchdog is still monitoring the process.
* @return <tt>true</tt> if the process is still running, otherwise
* @return <tt>true</tt> if the process is still running, otherwise
* <tt>false</tt>.
*/
public boolean isWatching(){
@@ -202,7 +202,7 @@ public class ExecuteWatchdog implements TimeoutObserver {

/**
* Indicates whether the last process run was killed on timeout or not.
* @return <tt>true</tt> if the process was killed otherwise
* @return <tt>true</tt> if the process was killed otherwise
* <tt>false</tt>.
*/
public boolean killedProcess(){


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/FixCRLF.java View File

@@ -1025,7 +1025,7 @@ public class FixCRLF extends MatchingTask {
* @see EnumeratedAttribute#getValues
*/
public String[] getValues() {
return new String[] {"asis", "cr", "lf", "crlf",
return new String[] {"asis", "cr", "lf", "crlf",
"mac", "unix", "dos"};
}
}


+ 30
- 30
src/main/org/apache/tools/ant/taskdefs/GenerateKey.java View File

@@ -62,7 +62,7 @@ import org.apache.tools.ant.util.JavaEnvUtils;

/**
* Generates a key in a keystore.
*
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*
* @since Ant 1.2
@@ -74,15 +74,15 @@ public class GenerateKey extends Task {
public static class DnameParam {
private String name;
private String value;
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setValue(String value) {
this.value = value;
}
@@ -94,14 +94,14 @@ public class GenerateKey extends Task {

public static class DistinguishedName {
private Vector params = new Vector();
public Object createParam() {
DnameParam param = new DnameParam();
params.addElement(param);
return param;
}
public Enumeration getParams() {
return params.elements();
}
@@ -122,7 +122,7 @@ public class GenerateKey extends Task {
sb.append('=');
sb.append(encode(param.getValue()));
}
return sb.toString();
}

@@ -132,9 +132,9 @@ public class GenerateKey extends Task {
if (-1 == end) {
return string;
}
final StringBuffer sb = new StringBuffer();
int start = 0;

while (-1 != end) {
@@ -145,8 +145,8 @@ public class GenerateKey extends Task {
}

sb.append(string.substring(start));
return sb.toString();
return sb.toString();
}
}

@@ -276,8 +276,8 @@ public class GenerateKey extends Task {
* @todo Could convert this to a plain Integer setter.
*/
public void setKeysize(final String keysize) throws BuildException {
try {
this.keysize = Integer.parseInt(keysize);
try {
this.keysize = Integer.parseInt(keysize);
} catch (final NumberFormatException nfe) {
throw new BuildException("KeySize attribute should be a integer");
}
@@ -290,8 +290,8 @@ public class GenerateKey extends Task {
* @throws BuildException If not an Integer
*/
public void setValidity(final String validity) throws BuildException {
try {
this.validity = Integer.parseInt(validity);
try {
this.validity = Integer.parseInt(validity);
} catch (final NumberFormatException nfe) {
throw new BuildException("Validity attribute should be a integer");
}
@@ -303,7 +303,7 @@ public class GenerateKey extends Task {
*/
public void setVerbose(final boolean verbose) {
this.verbose = verbose;
}
}

public void execute() throws BuildException {
if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) {
@@ -313,15 +313,15 @@ public class GenerateKey extends Task {

if (null == alias) {
throw new BuildException("alias attribute must be set");
}
}

if (null == storepass) {
throw new BuildException("storepass attribute must be set");
}
}

if (null == dname && null == expandedDname) {
throw new BuildException("dname must be set");
}
}

final StringBuffer sb = new StringBuffer();

@@ -329,7 +329,7 @@ public class GenerateKey extends Task {

if (verbose) {
sb.append("-v ");
}
}

sb.append("-alias \"");
sb.append(alias);
@@ -339,13 +339,13 @@ public class GenerateKey extends Task {
sb.append("-dname \"");
sb.append(dname);
sb.append("\" ");
}
}

if (null != expandedDname) {
sb.append("-dname \"");
sb.append(expandedDname);
sb.append("\" ");
}
}

if (null != keystore) {
sb.append("-keystore \"");
@@ -357,13 +357,13 @@ public class GenerateKey extends Task {
sb.append("-storepass \"");
sb.append(storepass);
sb.append("\" ");
}
}

if (null != storetype) {
sb.append("-storetype \"");
sb.append(storetype);
sb.append("\" ");
}
}

sb.append("-keypass \"");
if (null != keypass) {
@@ -377,26 +377,26 @@ public class GenerateKey extends Task {
sb.append("-sigalg \"");
sb.append(sigalg);
sb.append("\" ");
}
}

if (null != keyalg) {
sb.append("-keyalg \"");
sb.append(keyalg);
sb.append("\" ");
}
}


if (0 < keysize) {
sb.append("-keysize \"");
sb.append(keysize);
sb.append("\" ");
}
}

if (0 < validity) {
sb.append("-validity \"");
sb.append(validity);
sb.append("\" ");
}
}

log("Generating Key for " + alias);
final ExecTask cmd = (ExecTask) getProject().createTask("exec");
@@ -406,6 +406,6 @@ public class GenerateKey extends Task {
cmd.setFailonerror(true);
cmd.setTaskName(getTaskName());
cmd.execute();
}
}
}


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Get.java View File

@@ -148,7 +148,7 @@ public class Get extends Task {
try {
Object encoder =
Class.forName("sun.misc.BASE64Encoder").newInstance();
encoding = (String)
encoding = (String)
encoder.getClass().getMethod("encode", new Class[] {byte[].class})
.invoke(encoder, new Object[] {up.getBytes()});



+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/ImportTask.java View File

@@ -67,7 +67,7 @@ import java.util.Vector;
* Task to import another build file into the current project.
* <p>
* It must be 'top level'. On execution it will read another Ant file
* into the same Project.
* into the same Project.
* <p>
* <b>Important</b>: there is one limitation related to the top level
* elements in the imported files. The current implementation will
@@ -77,7 +77,7 @@ import java.util.Vector;
* <b>Important</b>: we have not finalized how relative file references
* will be resolved in deep/complex build hierarchies -such as what happens
* when an imported file imports another file. Use absolute references for
* enhanced build file stability, especially in the imported files.
* enhanced build file stability, especially in the imported files.
*
* Examples
* <pre>
@@ -109,7 +109,7 @@ public class ImportTask extends Task {
// for relative paths.
this.file=file;
}
/**
* This relies on the task order model.
*


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/Input.java View File

@@ -137,7 +137,7 @@ public class Input extends Task {
* @exception BuildException
*/
public void execute () throws BuildException {
if (addproperty != null
if (addproperty != null
&& getProject().getProperty(addproperty) != null) {
log("skipping " + getTaskName() + " as property " + addproperty
+ " has already been set.");
@@ -154,7 +154,7 @@ public class Input extends Task {
getProject().getInputHandler().handleInput(request);

String value = request.getInput();
if ((value == null || value.trim().length() == 0)
if ((value == null || value.trim().length() == 0)
&& defaultvalue != null) {
value = defaultvalue;
}


+ 9
- 9
src/main/org/apache/tools/ant/taskdefs/Jar.java View File

@@ -104,7 +104,7 @@ public class Jar extends Zip {
/** merged manifests added through filesets */
private Manifest filesetManifest;

/**
/**
* Manifest of original archive, will be set to null if not in
* update mode.
*/
@@ -127,7 +127,7 @@ public class Jar extends Zip {

/** The encoding to use when reading in a manifest file */
private String manifestEncoding;
/**
* The file found from the 'manifest' attribute. This can be
* either the location of a manifest, or the name of a jar added
@@ -139,7 +139,7 @@ public class Jar extends Zip {
/** jar index is JDK 1.3+ only */
private boolean index = false;

/**
/**
* whether to really create the archive in createEmptyZip, will
* get set in getResourcesToAdd.
*/
@@ -270,7 +270,7 @@ public class Jar extends Zip {
ZipFile zf = null;
try {
zf = new ZipFile(jarFile);
// must not use getEntry as "well behaving" applications
// must accept the manifest in any capitalization
Enumeration enum = zf.entries();
@@ -522,7 +522,7 @@ public class Jar extends Zip {
manifest = getManifest(file);
}
} catch (UnsupportedEncodingException e) {
throw new BuildException("Unsupported encoding while reading "
throw new BuildException("Unsupported encoding while reading "
+ "manifest: " + e.getMessage(), e);
}
} else if (filesetManifestConfig != null &&
@@ -551,7 +551,7 @@ public class Jar extends Zip {
filesetManifest.merge(newManifest);
}
} catch (UnsupportedEncodingException e) {
throw new BuildException("Unsupported encoding while reading "
throw new BuildException("Unsupported encoding while reading "
+ "manifest: " + e.getMessage(), e);
} catch (ManifestException e) {
log("Manifest in file " + file + " is invalid: "
@@ -617,7 +617,7 @@ public class Jar extends Zip {
} else {
Manifest mf = createManifest();
if (!mf.equals(originalManifest)) {
log("Updating jar since jar manifest has changed",
log("Updating jar since jar manifest has changed",
Project.MSG_VERBOSE);
needsUpdate = true;
}
@@ -641,10 +641,10 @@ public class Jar extends Zip {
if (!createEmpty) {
return true;
}
ZipOutputStream zOut = null;
try {
log("Building MANIFEST-only jar: "
log("Building MANIFEST-only jar: "
+ getDestFile().getAbsolutePath());
zOut = new ZipOutputStream(new FileOutputStream(getDestFile()));



+ 29
- 29
src/main/org/apache/tools/ant/taskdefs/Java.java View File

@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -73,7 +73,7 @@ import org.apache.tools.ant.types.Reference;
* the same JVM for the called application thus resulting in much
* faster operation.
*
* @author Stefano Mazzocchi
* @author Stefano Mazzocchi
* <a href="mailto:stefano@apache.org">stefano@apache.org</a>
* @author Stefan Bodewig
* @author <a href="mailto:donal@savvion.com">Donal Quinlan</a>
@@ -102,7 +102,7 @@ public class Java extends Task {

int err = -1;
try {
if ((err = executeJava()) != 0) {
if ((err = executeJava()) != 0) {
if (failOnError) {
throw new BuildException("Java returned: " + err, getLocation());
} else {
@@ -136,11 +136,11 @@ public class Java extends Task {
log(cmdl.describeCommand(), Project.MSG_VERBOSE);
} else {
if (cmdl.getVmCommand().size() > 1) {
log("JVM args ignored when same JVM is used.",
log("JVM args ignored when same JVM is used.",
Project.MSG_WARN);
}
if (dir != null) {
log("Working directory ignored when same JVM is used.",
log("Working directory ignored when same JVM is used.",
Project.MSG_WARN);
}

@@ -150,14 +150,14 @@ public class Java extends Task {
}

if (cmdl.getBootclasspath() != null) {
log("bootclasspath ignored when same JVM is used.",
log("bootclasspath ignored when same JVM is used.",
Project.MSG_WARN);
}

log("Running in same VM " + cmdl.describeJavaCommand(),
log("Running in same VM " + cmdl.describeJavaCommand(),
Project.MSG_VERBOSE);
}
try {
if (fork) {
return run(cmdl.getCommandline());
@@ -188,13 +188,13 @@ public class Java extends Task {

/**
* Set the classpath to be used when running the Java class
*
*
* @param s an Ant Path object containing the classpath.
*/
public void setClasspath(Path s) {
createClasspath().append(s);
}
/**
* Adds a path to the classpath.
*/
@@ -267,9 +267,9 @@ public class Java extends Task {
public void setResultProperty(String resultProperty) {
this.resultProperty = resultProperty;
}
/**
* helper method to set result property to the
* helper method to set result property to the
* passed in value if appropriate
*/
protected void maybeSetResultPropertyValue(int result) {
@@ -278,7 +278,7 @@ public class Java extends Task {
project.setNewProperty(resultProperty, res);
}
}
/**
* If true, execute in a new VM.
*/
@@ -295,7 +295,7 @@ public class Java extends Task {
Project.MSG_WARN);
cmdl.createVmArgument().setLine(s);
}
/**
* Adds a JVM argument.
*/
@@ -309,7 +309,7 @@ public class Java extends Task {
public void setJvm(String s) {
cmdl.setVm(s);
}
/**
* Adds a system property.
*/
@@ -363,7 +363,7 @@ public class Java extends Task {
public void setInputString(String inputString) {
redirector.setInputString(inputString);
}
/**
* Controls whether error output of exec is logged. This is only useful
* when output is being redirected and error output is desired in the
@@ -372,7 +372,7 @@ public class Java extends Task {
public void setLogError(boolean logError) {
redirector.setLogError(logError);
}
/**
* File the error stream of the process is redirected to.
*
@@ -414,7 +414,7 @@ public class Java extends Task {
public void setJVMVersion(String value) {
cmdl.setVmversion(value);
}
/**
* Adds an environment variable.
*
@@ -467,8 +467,8 @@ public class Java extends Task {
super.handleOutput(line);
}
}
public int handleInput(byte[] buffer, int offset, int length)
public int handleInput(byte[] buffer, int offset, int length)
throws IOException {
if (redirector.getInputStream() != null) {
return redirector.handleInput(buffer, offset, length);
@@ -489,7 +489,7 @@ public class Java extends Task {
super.handleFlush(line);
}
}
/**
* Pass output sent to System.err to specified output file.
*
@@ -502,7 +502,7 @@ public class Java extends Task {
super.handleErrorOutput(line);
}
}
/**
* Pass output sent to System.err to specified output file.
*
@@ -515,7 +515,7 @@ public class Java extends Task {
super.handleErrorOutput(line);
}
}
/**
* Executes the given classname with the given arguments as it
* was a command line application.
@@ -539,11 +539,11 @@ public class Java extends Task {
* Executes the given classname with the given arguments in a separate VM.
*/
private int run(String[] command) throws BuildException {
Execute exe
Execute exe
= new Execute(redirector.createHandler(), createWatchdog());
exe.setAntRun(getProject());
if (dir == null) {
dir = getProject().getBaseDir();
} else if (!dir.exists() || !dir.isDirectory()) {
@@ -551,9 +551,9 @@ public class Java extends Task {
+ " is not a valid directory",
getLocation());
}
exe.setWorkingDirectory(dir);
String[] environment = env.getVariables();
if (environment != null) {
for (int i = 0; i < environment.length; i++) {
@@ -568,7 +568,7 @@ public class Java extends Task {
try {
int rc = exe.execute();
if (exe.killedProcess()) {
log("Timeout: killed the sub-process", Project.MSG_WARN);
log("Timeout: killed the sub-process", Project.MSG_WARN);
}
redirector.complete();
return rc;


+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/Javadoc.java View File

@@ -1523,7 +1523,7 @@ public class Javadoc extends Task {
log ("-linksource option not supported on JavaDoc < 1.4",
Project.MSG_VERBOSE);
}
this.linksource = b;
this.linksource = b;
}

/**
@@ -1537,7 +1537,7 @@ public class Javadoc extends Task {
log ("-breakiterator option not supported on JavaDoc < 1.4",
Project.MSG_VERBOSE);
}
this.breakiterator = b;
this.breakiterator = b;
}

/**
@@ -1845,7 +1845,7 @@ public class Javadoc extends Task {
toExecute.createArgument().setValue("-source");
toExecute.createArgument().setValue(source);
}
if (linksource && doclet == null) {
toExecute.createArgument().setValue("-linksource");
}


+ 6
- 6
src/main/org/apache/tools/ant/taskdefs/Jikes.java View File

@@ -86,9 +86,9 @@ public class Jikes {
protected Jikes(JikesOutputParser jop, String command, Project project) {
super();

System.err.println("As of Ant 1.2 released in October 2000, "
System.err.println("As of Ant 1.2 released in October 2000, "
+ "the Jikes class");
System.err.println("is considered to be dead code by the Ant "
System.err.println("is considered to be dead code by the Ant "
+ "developers and is unmaintained.");
System.err.println("Don\'t use it!");

@@ -113,7 +113,7 @@ public class Jikes {

// There have been reports that 300 files could be compiled
// so 250 is a conservative approach
if (myos.toLowerCase().indexOf("windows") >= 0
if (myos.toLowerCase().indexOf("windows") >= 0
&& args.length > 250) {
PrintWriter out = null;
try {
@@ -123,10 +123,10 @@ public class Jikes {
out.println(args[i]);
}
out.flush();
commandArray = new String[] { command,
commandArray = new String[] { command,
"@" + tmpFile.getAbsolutePath()};
} catch (IOException e) {
throw new BuildException("Error creating temporary file",
throw new BuildException("Error creating temporary file",
e);
} finally {
if (out != null) {
@@ -138,7 +138,7 @@ public class Jikes {
commandArray[0] = command;
System.arraycopy(args, 0, commandArray, 1, args.length);
}
// We assume, that everything jikes writes goes to
// standard output, not to standard error. The option
// -Xstdout that is given to Jikes in Javac.doJikesCompile()


+ 5
- 5
src/main/org/apache/tools/ant/taskdefs/JikesOutputParser.java View File

@@ -80,7 +80,7 @@ public class JikesOutputParser implements ExecuteStreamHandler {
protected int warnings;
protected boolean error = false;
protected boolean emacsMode;
protected BufferedReader br;

/**
@@ -119,9 +119,9 @@ public class JikesOutputParser implements ExecuteStreamHandler {
protected JikesOutputParser(Task task, boolean emacsMode) {
super();

System.err.println("As of Ant 1.2 released in October 2000, the "
System.err.println("As of Ant 1.2 released in October 2000, the "
+ "JikesOutputParser class");
System.err.println("is considered to be dead code by the Ant "
System.err.println("is considered to be dead code by the Ant "
+ "developers and is unmaintained.");
System.err.println("Don\'t use it!");

@@ -145,9 +145,9 @@ public class JikesOutputParser implements ExecuteStreamHandler {
String line;
String lower;
// We assume, that every output, jike does, stands for an error/warning
// XXX
// XXX
// Is this correct?
// TODO:
// A warning line, that shows code, which contains a variable
// error will cause some trouble. The parser should definitely


+ 10
- 10
src/main/org/apache/tools/ant/taskdefs/KeySubst.java View File

@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000,2002 The Apache Software Foundation. All rights
* Copyright (c) 2000,2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -68,7 +68,7 @@ import org.apache.tools.ant.Task;
/**
* Keyword substitution. Input file is written to output file.
* Do not make input file same as output file.
* Keywords in input files look like this: @foo@. See the docs for the
* Keywords in input files look like this: @foo@. See the docs for the
* setKeys method to understand how to do the substitutions.
*
* @author Jon S. Stevens <a href="mailto:jon@clearink.com">jon@clearink.com</a>
@@ -81,7 +81,7 @@ public class KeySubst extends Task {
private File dest = null;
private String sep = "*";
private Hashtable replacements = new Hashtable();
/**
Do the execution.
*/
@@ -90,7 +90,7 @@ public class KeySubst extends Task {
log("Performing Substitions");
if (source == null || dest == null) {
log("Source and destinations must not be null");
return;
return;
}
BufferedReader br = null;
BufferedWriter bw = null;
@@ -152,7 +152,7 @@ public class KeySubst extends Task {
}
/**
* Sets the keys.
*
*
Format string is like this:
<p>
name=value*name2=value
@@ -170,21 +170,21 @@ public class KeySubst extends Task {
String token = tok.nextToken().trim();
StringTokenizer itok =
new StringTokenizer(token, "=", false);
String name = itok.nextToken();
String value = itok.nextToken();
replacements.put(name, value);
}
}
}

public static void main(String[] args) {
try {
Hashtable hash = new Hashtable();
hash.put("VERSION", "1.0.3");
hash.put("b", "ffff");
System.out.println(KeySubst.replace("$f ${VERSION} f ${b} jj $",
System.out.println(KeySubst.replace("$f ${VERSION} f ${b} jj $",
hash));
} catch (Exception e) {
e.printStackTrace();
@@ -193,7 +193,7 @@ public class KeySubst extends Task {

/**
Does replacement on text using the hashtable of keys.
@return the string with the replacements in it.
*/
public static String replace(String origString, Hashtable keys)
@@ -203,7 +203,7 @@ public class KeySubst extends Task {
int i = 0;
String key = null;
while ((index = origString.indexOf("${", i)) > -1) {
key = origString.substring(index + 2, origString.indexOf("}",
key = origString.substring(index + 2, origString.indexOf("}",
index + 3));
finalString.append (origString.substring(i, index));
if (keys.containsKey(key)) {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/LoadFile.java View File

@@ -189,7 +189,7 @@ public final class LoadFile extends Task {
crh.setFilterChains(filterChains);
crh.setProject(getProject());
instream = crh.getAssembledReader();
text = crh.readFully(instream);
}



+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/LogOutputStream.java View File

@@ -110,12 +110,12 @@ public class LogOutputStream extends OutputStream {
}

/**
* Flush this log stream
* Flush this log stream
*/
public void flush() {
processBuffer();
}

/**
* Converts the buffer to a string and sends it to <code>processLine</code>


+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/Manifest.java View File

@@ -637,7 +637,7 @@ public class Manifest {
while (e.hasMoreElements()) {
String key = (String) e.nextElement();
Attribute attribute = getAttribute(key);
cloned.storeAttribute(new Attribute(attribute.getName(),
cloned.storeAttribute(new Attribute(attribute.getName(),
attribute.getValue()));
}
return cloned;
@@ -729,9 +729,9 @@ public class Manifest {
+ defManifest);
}
try {
Manifest defaultManifest
Manifest defaultManifest
= new Manifest(new InputStreamReader(in, "UTF-8"));
Attribute createdBy = new Attribute("Created-By",
Attribute createdBy = new Attribute("Created-By",
System.getProperty("java.vm.version") + " ("
+ System.getProperty("java.vm.vendor") + ")" );
defaultManifest.getMainSection().storeAttribute(createdBy);


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/ManifestTask.java View File

@@ -96,11 +96,11 @@ public class ManifestTask extends Task {
*/
private Mode mode;

/**
/**
* The encoding of the manifest file
*/
private String encoding;
/**
* Helper class for Manifest's mode attribute.
*/


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/MatchingTask.java View File

@@ -410,7 +410,7 @@ public abstract class MatchingTask extends Task implements SelectorContainer {
public void addDepend(DependSelector selector) {
fileset.addDepend(selector);
}
/**
* add a regular expression selector entry on the selector list
*/


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/Mkdir.java View File

@@ -87,14 +87,14 @@ public class Mkdir extends Task {

if (dir.isFile()) {
throw new BuildException("Unable to create directory as a file "
+ "already exists with that name: "
+ "already exists with that name: "
+ dir.getAbsolutePath());
}

if (!dir.exists()) {
boolean result = dir.mkdirs();
if (!result) {
String msg = "Directory " + dir.getAbsolutePath()
String msg = "Directory " + dir.getAbsolutePath()
+ " creation was not successful for an unknown reason";
throw new BuildException(msg, getLocation());
}


+ 41
- 41
src/main/org/apache/tools/ant/taskdefs/Parallel.java View File

@@ -66,14 +66,14 @@ import org.apache.tools.ant.util.StringUtils;
* Executes the contained tasks in separate threads, continuing
* once all are completed.
* <p>
* New behavior allows for the ant script to specify a maximum number of
* New behavior allows for the ant script to specify a maximum number of
* threads that will be executed in parallel. One should be very careful about
* using the <code>waitFor</code> task when specifying <code>threadCount</code>
* as it can cause deadlocks if the number of threads is too small or if one of
* the nested tasks fails to execute completely. The task selection algorithm
* will insure that the tasks listed before a task have started before that
* task is started, but it will not insure a successful completion of those
* tasks or that those tasks will finish first (i.e. it's a classic race
* as it can cause deadlocks if the number of threads is too small or if one of
* the nested tasks fails to execute completely. The task selection algorithm
* will insure that the tasks listed before a task have started before that
* task is started, but it will not insure a successful completion of those
* tasks or that those tasks will finish first (i.e. it's a classic race
* condition).
* </p>
* @author Thomas Christen <a href="mailto:chr@active.ch">chr@active.ch</a>
@@ -91,13 +91,13 @@ public class Parallel extends Task

/** Semaphore to notify of completed threads */
private final Object semaphore = new Object();
/** Total number of threads to run */
private int numThreads = 0;
/** Total number of threads per processor to run. */
private int numThreadsPerProcessor = 0;
/** Interval (in ms) to poll for finished threads. */
private int pollInterval = 1000; // default is once a second

@@ -108,28 +108,28 @@ public class Parallel extends Task
public void addTask(Task nestedTask) {
nestedTasks.addElement(nestedTask);
}
/**
* Dynamically generates the number of threads to execute based on the
* number of available processors (via
* <code>java.lang.Runtime.availableProcessors()</code>). Requires a J2SE
* 1.4 VM, and it will overwrite the value set in threadCount.
* If used in a 1.1, 1.2, or 1.3 VM then the task will defer to
/**
* Dynamically generates the number of threads to execute based on the
* number of available processors (via
* <code>java.lang.Runtime.availableProcessors()</code>). Requires a J2SE
* 1.4 VM, and it will overwrite the value set in threadCount.
* If used in a 1.1, 1.2, or 1.3 VM then the task will defer to
* <code>threadCount</code>.; optional
* @param numThreadsPerProcessor Number of threads to create per available
* @param numThreadsPerProcessor Number of threads to create per available
* processor.
*
*/
public void setThreadsPerProcessor(int numThreadsPerProcessor) {
this.numThreadsPerProcessor = numThreadsPerProcessor;
}
/**
* Statically determine the maximum number of tasks to execute
* simultaneously. If there are less tasks than threads then all will be
* executed at once, if there are more then only <code>threadCount</code>
* tasks will be executed at one time. If <code>threadsPerProcessor</code>
* is set and the JVM is at least a 1.4 VM then this value is
/**
* Statically determine the maximum number of tasks to execute
* simultaneously. If there are less tasks than threads then all will be
* executed at once, if there are more then only <code>threadCount</code>
* tasks will be executed at one time. If <code>threadsPerProcessor</code>
* is set and the JVM is at least a 1.4 VM then this value is
* ignored.; optional
*
* @param numThreads total number of therads.
@@ -139,8 +139,8 @@ public class Parallel extends Task
this.numThreads = numThreads;
}

/**
* Interval to poll for completed threads when threadCount or
/**
* Interval to poll for completed threads when threadCount or
* threadsPerProcessor is specified. Integer in milliseconds.; optional
*
* @param pollInterval New value of property pollInterval.
@@ -148,7 +148,7 @@ public class Parallel extends Task
public void setPollInterval(int pollInterval) {
this.pollInterval = pollInterval;
}
/**
* Execute the parallel tasks
*
@@ -161,7 +161,7 @@ public class Parallel extends Task
}
spinThreads();
}
/**
* Determine the number of threads based on the number of processors
*/
@@ -173,7 +173,7 @@ public class Parallel extends Task
}
}
}
/**
* Spin up required threads with a maximum number active at any given time.
*
@@ -184,11 +184,11 @@ public class Parallel extends Task
Thread[] threads = new Thread[numTasks];
TaskRunnable[] runnables = new TaskRunnable[numTasks];
int threadNumber = 0;
for (Enumeration e = nestedTasks.elements(); e.hasMoreElements();
for (Enumeration e = nestedTasks.elements(); e.hasMoreElements();
threadNumber++) {
Task nestedTask = (Task) e.nextElement();
ThreadGroup group = new ThreadGroup("parallel");
TaskRunnable taskRunnable
TaskRunnable taskRunnable
= new TaskRunnable(threadNumber, nestedTask);
runnables[threadNumber] = taskRunnable;
threads[threadNumber] = new Thread(group, taskRunnable);
@@ -197,7 +197,7 @@ public class Parallel extends Task
final int maxRunning = numThreads;
Thread[] running = new Thread[maxRunning];
threadNumber = 0;
// now run them in limited numbers...
outer:
while (threadNumber < numTasks) {
@@ -206,7 +206,7 @@ public class Parallel extends Task
if (running[i] == null || !running[i].isAlive()) {
running[i] = threads[threadNumber++];
running[i].start();
// countinue on outer while loop in case we
// countinue on outer while loop in case we
// used our last thread
continue outer;
}
@@ -221,8 +221,8 @@ public class Parallel extends Task
}
}
}
// now join to all the threads
// now join to all the threads
for (int i = 0; i < maxRunning; ++i) {
try {
if (running[i] != null) {
@@ -232,7 +232,7 @@ public class Parallel extends Task
// who would interrupt me at a time like this?
}
}
// now did any of the threads throw an exception
StringBuffer exceptionMessage = new StringBuffer();
int numExceptions = 0;
@@ -245,7 +245,7 @@ public class Parallel extends Task
if (firstException == null) {
firstException = t;
}
if (t instanceof BuildException &&
if (t instanceof BuildException &&
firstLocation == Location.UNKNOWN_LOCATION) {
firstLocation = ((BuildException) t).getLocation();
}
@@ -253,7 +253,7 @@ public class Parallel extends Task
exceptionMessage.append(t.getMessage());
}
}
if (numExceptions == 1) {
if (firstException instanceof BuildException) {
throw (BuildException) firstException;
@@ -261,11 +261,11 @@ public class Parallel extends Task
throw new BuildException(firstException);
}
} else if (numExceptions > 1) {
throw new BuildException(exceptionMessage.toString(),
throw new BuildException(exceptionMessage.toString(),
firstLocation);
}
}
/**
* Determine the number of processors. Only effective on later VMs
*
@@ -328,5 +328,5 @@ public class Parallel extends Task
return exception;
}
}
}

+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/Patch.java View File

@@ -90,7 +90,7 @@ public class Patch extends Task {
*/
public void setPatchfile(File file) {
if (!file.exists()) {
throw new BuildException("patchfile " + file + " doesn\'t exist",
throw new BuildException("patchfile " + file + " doesn\'t exist",
getLocation());
}
cmd.createArgument().setValue("-i");
@@ -165,9 +165,9 @@ public class Patch extends Task {
*/
public void execute() throws BuildException {
if (!havePatchfile) {
throw new BuildException("patchfile argument is required",
throw new BuildException("patchfile argument is required",
getLocation());
}
}
Commandline toExecute = (Commandline) cmd.clone();
toExecute.setExecutable("patch");

@@ -176,7 +176,7 @@ public class Patch extends Task {
}

Execute exe = new Execute(new LogStreamHandler(this, Project.MSG_INFO,
Project.MSG_WARN),
Project.MSG_WARN),
null);
exe.setCommandline(toExecute.getCommandline());



+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/PathConvert.java View File

@@ -237,7 +237,7 @@ public class PathConvert extends Task {
/**
* Set targetos to a platform to one of
* "windows", "unix", "netware", or "os/2".
*
*
* Required unless unless pathsep and/or dirsep are specified.
*
* @deprecated use the method taking a TargetOs argument instead


+ 22
- 22
src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java View File

@@ -74,14 +74,14 @@ class ProcessDestroyer
private Method addShutdownHookMethod;
private Method removeShutdownHookMethod;
private ProcessDestroyerImpl destroyProcessThread = null;
// whether or not this ProcessDestroyer has been registered as a
// shutdown hook
private boolean added = false;
private class ProcessDestroyerImpl extends Thread{
private boolean shouldDestroy = true;
public ProcessDestroyerImpl(){
super("ProcessDestroyer Shutdown Hook");
}
@@ -90,30 +90,30 @@ class ProcessDestroyer
ProcessDestroyer.this.run();
}
}
public void setShouldDestroy(boolean shouldDestroy){
this.shouldDestroy = shouldDestroy;
}
}
/**
* Constructs a <code>ProcessDestroyer</code> and obtains
* <code>Runtime.addShutdownHook()</code> and
* <code>Runtime.removeShutdownHook()</code> through reflection. The
* ProcessDestroyer manages a list of processes to be destroyed when the
* VM exits. If a process is added when the list is empty,
* this <code>ProcessDestroyer</code> is registered as a shutdown hook. If
* Constructs a <code>ProcessDestroyer</code> and obtains
* <code>Runtime.addShutdownHook()</code> and
* <code>Runtime.removeShutdownHook()</code> through reflection. The
* ProcessDestroyer manages a list of processes to be destroyed when the
* VM exits. If a process is added when the list is empty,
* this <code>ProcessDestroyer</code> is registered as a shutdown hook. If
* removing a process results in an empty list, the
* <code>ProcessDestroyer</code> is removed as a shutdown hook.
*/
public ProcessDestroyer() {
try {
// check to see if the shutdown hook methods exists
// check to see if the shutdown hook methods exists
// (support pre-JDK 1.3 VMs)
Class[] paramTypes = {Thread.class};
addShutdownHookMethod =
Runtime.class.getMethod("addShutdownHook", paramTypes);
removeShutdownHookMethod =
Runtime.class.getMethod("removeShutdownHook", paramTypes);
// wait to add shutdown hook as needed
@@ -121,9 +121,9 @@ class ProcessDestroyer
// it just won't be added as a shutdown hook... :(
}
}
/**
* Registers this <code>ProcessDestroyer</code> as a shutdown hook,
* Registers this <code>ProcessDestroyer</code> as a shutdown hook,
* uses reflection to ensure pre-JDK 1.3 compatibility.
*/
private void addShutdownHook(){
@@ -140,7 +140,7 @@ class ProcessDestroyer
}
}
}
/**
* Registers this <code>ProcessDestroyer</code> as a shutdown hook,
* uses reflection to ensure pre-JDK 1.3 compatibility
@@ -161,7 +161,7 @@ class ProcessDestroyer
destroyProcessThread.setShouldDestroy(false);
destroyProcessThread.start();
// this should return quickly, since Process.destroy()
try{
try{
destroyProcessThread.join(20000);
}catch(InterruptedException ie){
// the thread didn't die in time
@@ -174,27 +174,27 @@ class ProcessDestroyer
}
}
}
/**
* Returns whether or not the ProcessDestroyer is registered as
* Returns whether or not the ProcessDestroyer is registered as
* as shutdown hook
* @return true if this is currently added as shutdown hook
*/
public boolean isAddedAsShutdownHook(){
return added;
}
/**
* Returns <code>true</code> if the specified <code>Process</code> was
* successfully added to the list of processes to destroy upon VM exit.
*
*
* @param process the process to add
* @return <code>true</code> if the specified <code>Process</code> was
* successfully added
*/
public boolean add(Process process) {
synchronized(processes){
// if this list is empty, register the shutdown hook
// if this list is empty, register the shutdown hook
if(processes.size() == 0){
addShutdownHook();
}


+ 6
- 6
src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java View File

@@ -76,8 +76,8 @@ public class PumpStreamHandler implements ExecuteStreamHandler {
private OutputStream out;
private OutputStream err;
private InputStream input;
public PumpStreamHandler(OutputStream out, OutputStream err,
public PumpStreamHandler(OutputStream out, OutputStream err,
InputStream input) {
this.out = out;
this.err = err;
@@ -116,7 +116,7 @@ public class PumpStreamHandler implements ExecuteStreamHandler {
} catch (IOException e) {
//ignore
}
}
}
}

public void start() {
@@ -144,7 +144,7 @@ public class PumpStreamHandler implements ExecuteStreamHandler {
inputThread.join();
} catch (InterruptedException e) {
// ignore
}
}
}

try {
@@ -188,9 +188,9 @@ public class PumpStreamHandler implements ExecuteStreamHandler {
* Creates a stream pumper to copy the given input stream to the
* given output stream.
*/
protected Thread createPump(InputStream is, OutputStream os,
protected Thread createPump(InputStream is, OutputStream os,
boolean closeWhenExhausted) {
final Thread result
final Thread result
= new Thread(new StreamPumper(is, os, closeWhenExhausted));
result.setDaemon(true);
return result;


+ 40
- 40
src/main/org/apache/tools/ant/taskdefs/Replace.java View File

@@ -78,11 +78,11 @@ import org.apache.tools.ant.util.StringUtils;

/**
* Replaces all occurrences of one or more string tokens with given
* values in the indicated files. Each value can be either a string
* values in the indicated files. Each value can be either a string
* or the value of a property available in a designated property file.
* If you want to replace a text that crosses line boundaries, you
* must use a nested <code>&lt;replacetoken&gt;</code> element.
* @author Stefano Mazzocchi
* @author Stefano Mazzocchi
* <a href="mailto:stefano@apache.org">stefano@apache.org</a>
* @author <a href="mailto:erik@desknetinc.com">Erik Langenbach</a>
*
@@ -91,7 +91,7 @@ import org.apache.tools.ant.util.StringUtils;
* @ant.task category="filesystem"
*/
public class Replace extends MatchingTask {
private File src = null;
private NestedString token = null;
private NestedString value = new NestedString();
@@ -104,12 +104,12 @@ public class Replace extends MatchingTask {
private File dir = null;

private int fileCount;
private int replaceCount;
private int replaceCount;
private boolean summary = false;
/** The encoding used to read and write files - if null, uses default */
private String encoding = null;
private FileUtils fileUtils = FileUtils.newFileUtils();

/**
@@ -143,7 +143,7 @@ public class Replace extends MatchingTask {
public void validate() throws BuildException {
//Validate mandatory attributes
if (token == null) {
String message = "token is a mandatory attribute "
String message = "token is a mandatory attribute "
+ "of replacefilter.";
throw new BuildException(message);
}
@@ -156,8 +156,8 @@ public class Replace extends MatchingTask {

//value and property are mutually exclusive attributes
if ((value != null) && (property != null)) {
String message = "Either value or property "
+ "can be specified, but a replacefilter "
String message = "Either value or property "
+ "can be specified, but a replacefilter "
+ "element cannot have both.";
throw new BuildException(message);
}
@@ -174,7 +174,7 @@ public class Replace extends MatchingTask {
//Make sure property exists in property file
if (properties == null ||
properties.getProperty(property) == null) {
String message = "property \"" + property
String message = "property \"" + property
+ "\" was not found in " + propertyFile.getPath();
throw new BuildException(message);
}
@@ -256,7 +256,7 @@ public class Replace extends MatchingTask {
public void execute() throws BuildException {

Vector savedFilters = (Vector) replacefilters.clone();
Properties savedProperties =
Properties savedProperties =
properties == null ? null : (Properties) properties.clone();

try {
@@ -270,42 +270,42 @@ public class Replace extends MatchingTask {
replaceFilter.setValue(props.getProperty(token));
}
}
validateAttributes();
if (propertyFile != null) {
properties = getProperties(propertyFile);
}
validateReplacefilters();
fileCount = 0;
replaceCount = 0;
if (src != null) {
processFile(src);
}
if (dir != null) {
DirectoryScanner ds = super.getDirectoryScanner(dir);
String[] srcs = ds.getIncludedFiles();
for (int i = 0; i < srcs.length; i++) {
File file = new File(dir, srcs[i]);
processFile(file);
}
}
if (summary) {
log("Replaced " + replaceCount + " occurrences in "
log("Replaced " + replaceCount + " occurrences in "
+ fileCount + " files.", Project.MSG_INFO);
}
} finally {
replacefilters = savedFilters;
properties = savedProperties;
} // end of finally
}
/**
* Validate attributes provided for this task in .xml build file.
*
@@ -314,12 +314,12 @@ public class Replace extends MatchingTask {
*/
public void validateAttributes() throws BuildException {
if (src == null && dir == null) {
String message = "Either the file or the dir attribute "
String message = "Either the file or the dir attribute "
+ "must be specified";
throw new BuildException(message, getLocation());
}
if (propertyFile != null && !propertyFile.exists()) {
String message = "Property file " + propertyFile.getPath()
String message = "Property file " + propertyFile.getPath()
+ " does not exist.";
throw new BuildException(message, getLocation());
}
@@ -343,7 +343,7 @@ public class Replace extends MatchingTask {
public void validateReplacefilters()
throws BuildException {
for (int i = 0; i < replacefilters.size(); i++) {
Replacefilter element =
Replacefilter element =
(Replacefilter) replacefilters.elementAt(i);
element.validate();
}
@@ -362,11 +362,11 @@ public class Replace extends MatchingTask {
try {
properties.load(new FileInputStream(propertyFile));
} catch (FileNotFoundException e) {
String message = "Property file (" + propertyFile.getPath()
String message = "Property file (" + propertyFile.getPath()
+ ") not found.";
throw new BuildException(message);
} catch (IOException e) {
String message = "Property file (" + propertyFile.getPath()
String message = "Property file (" + propertyFile.getPath()
+ ") cannot be loaded.";
throw new BuildException(message);
}
@@ -384,11 +384,11 @@ public class Replace extends MatchingTask {
*/
private void processFile(File src) throws BuildException {
if (!src.exists()) {
throw new BuildException("Replace: source file " + src.getPath()
throw new BuildException("Replace: source file " + src.getPath()
+ " doesn't exist", getLocation());
}

File temp = fileUtils.createTempFile("rep", ".tmp",
File temp = fileUtils.createTempFile("rep", ".tmp",
fileUtils.getParentFile(src));

Reader reader = null;
@@ -398,7 +398,7 @@ public class Replace extends MatchingTask {
: new InputStreamReader(new FileInputStream(src), encoding);
writer = encoding == null ? new FileWriter(temp)
: new OutputStreamWriter(new FileOutputStream(temp), encoding);
BufferedReader br = new BufferedReader(reader);
BufferedWriter bw = new BufferedWriter(writer);

@@ -418,9 +418,9 @@ public class Replace extends MatchingTask {
StringUtils.LINE_SEP, false);
String tok = stringReplace(token.getText(), "\n",
StringUtils.LINE_SEP, false);
// for each found token, replace with value
log("Replacing in " + src.getPath() + ": " + token.getText()
log("Replacing in " + src.getPath() + ": " + token.getText()
+ " --> " + value.getText(), Project.MSG_VERBOSE);
newString = stringReplace(newString, tok, val, true);
}
@@ -449,8 +449,8 @@ public class Replace extends MatchingTask {
temp = null;
}
} catch (IOException ioe) {
throw new BuildException("IOException in " + src + " - " +
ioe.getClass().getName() + ":"
throw new BuildException("IOException in " + src + " - " +
ioe.getClass().getName() + ":"
+ ioe.getMessage(), ioe, getLocation());
} finally {
if (reader != null) {
@@ -467,7 +467,7 @@ public class Replace extends MatchingTask {
temp.delete();
}
}
}

/**
@@ -483,9 +483,9 @@ public class Replace extends MatchingTask {
Replacefilter filter = (Replacefilter) replacefilters.elementAt(i);

//for each found token, replace with value
log("Replacing in " + filename + ": " + filter.getToken()
log("Replacing in " + filename + ": " + filter.getToken()
+ " --> " + filter.getReplaceValue(), Project.MSG_VERBOSE);
newString = stringReplace(newString, filter.getToken(),
newString = stringReplace(newString, filter.getToken(),
filter.getReplaceValue(), true);
}

@@ -512,8 +512,8 @@ public class Replace extends MatchingTask {
public void setSummary(boolean summary) {
this.summary = summary;
}
/**
* Sets the name of a property file containing filters; optional.
* Each property will be treated as a
@@ -563,7 +563,7 @@ public class Replace extends MatchingTask {
public void setEncoding(String encoding) {
this.encoding = encoding;
}
/**
* the token to filter as the text of a nested element
* @return nested token to configure
@@ -605,7 +605,7 @@ public class Replace extends MatchingTask {

/**
* Replace occurrences of str1 in string str with str2
*/
*/
private String stringReplace(String str, String str1, String str2,
boolean countReplaces) {
StringBuffer ret = new StringBuffer();


+ 69
- 69
src/main/org/apache/tools/ant/taskdefs/SQLExec.java View File

@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -86,25 +86,25 @@ import java.sql.ResultSetMetaData;
* Executes a series of SQL statements on a database using JDBC.
*
* <p>Statements can
* either be read in from a text file using the <i>src</i> attribute or from
* either be read in from a text file using the <i>src</i> attribute or from
* between the enclosing SQL tags.</p>
*
* <p>Multiple statements can be provided, separated by semicolons (or the
* defined <i>delimiter</i>). Individual lines within the statements can be
*
* <p>Multiple statements can be provided, separated by semicolons (or the
* defined <i>delimiter</i>). Individual lines within the statements can be
* commented using either --, // or REM at the start of the line.</p>
*
* <p>The <i>autocommit</i> attribute specifies whether auto-commit should be
* turned on or off whilst executing the statements. If auto-commit is turned
* on each statement will be executed and committed. If it is turned off the
*
* <p>The <i>autocommit</i> attribute specifies whether auto-commit should be
* turned on or off whilst executing the statements. If auto-commit is turned
* on each statement will be executed and committed. If it is turned off the
* statements will all be executed as one transaction.</p>
*
* <p>The <i>onerror</i> attribute specifies how to proceed when an error occurs
* during the execution of one of the statements.
*
* <p>The <i>onerror</i> attribute specifies how to proceed when an error occurs
* during the execution of one of the statements.
* The possible values are: <b>continue</b> execution, only show the error;
* <b>stop</b> execution and commit transaction;
* and <b>abort</b> execution and transaction and fail task.</p>

*
*
* @author <a href="mailto:jeff@custommonkey.org">Jeff Martin</a>
* @author <A href="mailto:gholam@xtra.co.nz">Michael McCallum</A>
* @author <A href="mailto:tim.stephenson@sybase.com">Tim Stephenson</A>
@@ -126,8 +126,8 @@ public class SQLExec extends JDBCTask {
}
}

private int goodSql = 0;

private int totalSql = 0;
@@ -166,13 +166,13 @@ public class SQLExec extends JDBCTask {
* SQL Statement delimiter
*/
private String delimiter = ";";
/**
* The delimiter type indicating whether the delimiter will
* only be recognized on a line by itself
*/
private String delimiterType = DelimiterType.NORMAL;
/**
* Print SQL results.
*/
@@ -188,12 +188,12 @@ public class SQLExec extends JDBCTask {
*/
private File output = null;

/**
* Action to perform if an error is found
**/
private String onError = "abort";
/**
* Encoding to use when reading SQL statements from a file
*/
@@ -203,7 +203,7 @@ public class SQLExec extends JDBCTask {
* Append to an existing file or overwrite it?
*/
private boolean append = false;
/**
* Keep the format of a sql block?
*/
@@ -223,15 +223,15 @@ public class SQLExec extends JDBCTask {
public void setSrc(File srcFile) {
this.srcFile = srcFile;
}
/**
* Set an inline SQL command to execute.
* Set an inline SQL command to execute.
* NB: Properties are not expanded in this text.
*/
public void addText(String sql) {
this.sqlCommand += sql;
}
/**
* Adds a set of files (nested fileset attribute).
*/
@@ -248,7 +248,7 @@ public class SQLExec extends JDBCTask {
transactions.addElement(t);
return t;
}
/**
* Set the file encoding to use on the SQL files read in
*
@@ -257,9 +257,9 @@ public class SQLExec extends JDBCTask {
public void setEncoding(String encoding) {
this.encoding = encoding;
}
/**
* Set the delimiter that separates SQL statements. Defaults to &quot;;&quot;;
* Set the delimiter that separates SQL statements. Defaults to &quot;;&quot;;
* optional
*
* <p>For example, set this to "go" and delimitertype to "ROW" for
@@ -280,7 +280,7 @@ public class SQLExec extends JDBCTask {
public void setDelimiterType(DelimiterType delimiterType) {
this.delimiterType = delimiterType.getValue();
}
/**
* Print result sets from the statements;
* optional, default false
@@ -288,9 +288,9 @@ public class SQLExec extends JDBCTask {
public void setPrint(boolean print) {
this.print = print;
}
/**
* Print headers for result sets from the
* Print headers for result sets from the
* statements; optional, default true.
*/
public void setShowheaders(boolean showheaders) {
@@ -298,7 +298,7 @@ public class SQLExec extends JDBCTask {
}

/**
* Set the output file;
* Set the output file;
* optional, defaults to the Ant log.
*/
public void setOutput(File output) {
@@ -315,7 +315,7 @@ public class SQLExec extends JDBCTask {
this.append = append;
}

/**
* Action to perform when statement fails: continue, stop, or abort
* optional; default &quot;abort&quot;
@@ -327,13 +327,13 @@ public class SQLExec extends JDBCTask {
/**
* whether or not format should be preserved.
* Defaults to false.
*
*
* @param keepformat The keepformat to set
*/
public void setKeepformat(boolean keepformat) {
this.keepformat = keepformat;
}
/**
* Set escape processing for statements.
*
@@ -353,15 +353,15 @@ public class SQLExec extends JDBCTask {
sqlCommand = sqlCommand.trim();

try {
if (srcFile == null && sqlCommand.length() == 0
&& filesets.isEmpty()) {
if (srcFile == null && sqlCommand.length() == 0
&& filesets.isEmpty()) {
if (transactions.size() == 0) {
throw new BuildException("Source file or fileset, "
+ "transactions or sql statement "
+ "must be set!", location);
}
}
if (srcFile != null && !srcFile.exists()) {
throw new BuildException("Source file does not exist!", location);
}
@@ -371,16 +371,16 @@ public class SQLExec extends JDBCTask {
FileSet fs = (FileSet) filesets.elementAt(i);
DirectoryScanner ds = fs.getDirectoryScanner(project);
File srcDir = fs.getDir(project);
String[] srcFiles = ds.getIncludedFiles();
// Make a transaction for each file
for (int j = 0 ; j < srcFiles.length ; j++) {
Transaction t = createTransaction();
t.setSrc(new File(srcDir, srcFiles[j]));
}
}
// Make a transaction group for the outer command
Transaction t = createTransaction();
t.setSrc(srcFile);
@@ -392,11 +392,11 @@ public class SQLExec extends JDBCTask {
try {
statement = conn.createStatement();
statement.setEscapeProcessing(escapeProcessing);
PrintStream out = System.out;
try {
if (output != null) {
log("Opening PrintStream to output file " + output,
log("Opening PrintStream to output file " + output,
Project.MSG_VERBOSE);
out = new PrintStream(
new BufferedOutputStream(
@@ -404,11 +404,11 @@ public class SQLExec extends JDBCTask {
.getAbsolutePath(),
append)));
}
// Process all transactions
for (Enumeration e = transactions.elements();
for (Enumeration e = transactions.elements();
e.hasMoreElements();) {
((Transaction) e.nextElement()).runTransaction(out);
if (!isAutocommit()) {
log("Commiting transaction", Project.MSG_VERBOSE);
@@ -419,7 +419,7 @@ public class SQLExec extends JDBCTask {
if (out != null && out != System.out) {
out.close();
}
}
}
} catch (IOException e){
if (!isAutocommit() && conn != null && onError.equals("abort")) {
try {
@@ -444,8 +444,8 @@ public class SQLExec extends JDBCTask {
}
} catch (SQLException e) {}
}
log(goodSql + " of " + totalSql +
log(goodSql + " of " + totalSql +
" SQL statements executed successfully");
} finally {
transactions = savedTransaction;
@@ -456,13 +456,13 @@ public class SQLExec extends JDBCTask {
/**
* read in lines and execute them
*/
protected void runStatements(Reader reader, PrintStream out)
protected void runStatements(Reader reader, PrintStream out)
throws SQLException, IOException {
StringBuffer sql = new StringBuffer();
String line = "";
BufferedReader in = new BufferedReader(reader);
while ((line = in.readLine()) != null){
if (!keepformat) {
line = line.trim();
@@ -483,13 +483,13 @@ public class SQLExec extends JDBCTask {
}
}
}
if (!keepformat) {
sql.append(" " + line);
} else {
sql.append("\n" + line);
}
// SQL defines "--" as a comment to EOL
// and in Oracle it may contain a hint
// so we cannot just remove it, instead we must end it
@@ -498,12 +498,12 @@ public class SQLExec extends JDBCTask {
sql.append("\n");
}
}
if ((delimiterType.equals(DelimiterType.NORMAL)
&& sql.toString().endsWith(delimiter))
if ((delimiterType.equals(DelimiterType.NORMAL)
&& sql.toString().endsWith(delimiter))
||
(delimiterType.equals(DelimiterType.ROW)
(delimiterType.equals(DelimiterType.ROW)
&& line.equals(delimiter))) {
execSQL(sql.substring(0, sql.length() - delimiter.length()),
execSQL(sql.substring(0, sql.length() - delimiter.length()),
out);
sql.replace(0, sql.length(), "");
}
@@ -513,8 +513,8 @@ public class SQLExec extends JDBCTask {
execSQL(sql.toString(), out);
}
}
/**
* Exec the sql statement.
*/
@@ -523,19 +523,19 @@ public class SQLExec extends JDBCTask {
if ("".equals(sql.trim())) {
return;
}
try {
try {
totalSql++;
log("SQL: " + sql, Project.MSG_VERBOSE);
if (!statement.execute(sql)) {
log(statement.getUpdateCount() + " rows affected",
log(statement.getUpdateCount() + " rows affected",
Project.MSG_VERBOSE);
} else {
if (print) {
printResults(out);
}
}
SQLWarning warning = conn.getWarnings();
while (warning != null){
log(warning + " sql warning", Project.MSG_VERBOSE);
@@ -551,7 +551,7 @@ public class SQLExec extends JDBCTask {
log(e.toString(), Project.MSG_ERR);
}
}
/**
* print any results in the statement.
*/
@@ -580,7 +580,7 @@ public class SQLExec extends JDBCTask {
if (columnValue != null) {
columnValue = columnValue.trim();
}
if (first) {
first = false;
} else {
@@ -634,20 +634,20 @@ public class SQLExec extends JDBCTask {
/**
*
*/
private void runTransaction(PrintStream out)
private void runTransaction(PrintStream out)
throws IOException, SQLException {
if (tSqlCommand.length() != 0) {
log("Executing commands", Project.MSG_INFO);
runStatements(new StringReader(tSqlCommand), out);
}
if (tSrcFile != null) {
log("Executing file: " + tSrcFile.getAbsolutePath(),
log("Executing file: " + tSrcFile.getAbsolutePath(),
Project.MSG_INFO);
Reader reader =
Reader reader =
(encoding == null) ? new FileReader(tSrcFile)
: new InputStreamReader(
new FileInputStream(tSrcFile),
new FileInputStream(tSrcFile),
encoding);
try {
runStatements(reader, out);


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/SendEmail.java View File

@@ -57,12 +57,12 @@ package org.apache.tools.ant.taskdefs;
import org.apache.tools.ant.taskdefs.email.EmailTask;

/**
* A task to send SMTP email.
* A task to send SMTP email.
* This task can send mail using either plain
* text, UU encoding or Mime format mail depending on what is available.
* Attachments may be sent using nested FileSet
* elements.
* @author glenn_twiggs@bmc.com
* @author Magesh Umasankar
*


+ 6
- 6
src/main/org/apache/tools/ant/taskdefs/Sequential.java View File

@@ -62,16 +62,16 @@ import org.apache.tools.ant.TaskContainer;


/**
* Sequential is a container task - it can contain other Ant tasks. The nested
* tasks are simply executed in sequence. Sequential's primary use is to support
* Sequential is a container task - it can contain other Ant tasks. The nested
* tasks are simply executed in sequence. Sequential's primary use is to support
* the sequential execution of a subset of tasks within the
{@link Parallel Parallel Task}
{@link Parallel Parallel Task}

* <p>
* The sequential task has no attributes and does not support any nested
* elements apart from Ant tasks. Any valid Ant task may be embedded within the
* The sequential task has no attributes and does not support any nested
* elements apart from Ant tasks. Any valid Ant task may be embedded within the
* sequential task.</p>
* @author Thomas Christen <a href="mailto:chr@active.ch">chr@active.ch</a>
* @since Ant 1.4
* @ant.task category="control"


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/SignJar.java View File

@@ -245,7 +245,7 @@ public class SignJar extends Task {
log("nested filesets will be ignored if the jar attribute has"
+ " been specified.", Project.MSG_WARN);
}
doOneJar(jar, signedjar);
return;
} else {


+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/StreamPumper.java View File

@@ -83,13 +83,13 @@ public class StreamPumper implements Runnable {
* @param closeWhenExhausted if true, the output stream will be closed when
* the input is exhausted.
*/
public StreamPumper(InputStream is, OutputStream os,
public StreamPumper(InputStream is, OutputStream os,
boolean closeWhenExhausted) {
this.is = is;
this.os = os;
this.closeWhenExhausted = closeWhenExhausted;
this.closeWhenExhausted = closeWhenExhausted;
}
/**
* Create a new stream pumper.
*


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Sync.java View File

@@ -163,7 +163,7 @@ public class Sync extends Task {
log("Removed " + count + " " + what + " from " + toDir,
Project.MSG_INFO);
} else {
log("NO " + what + " to remove from " + toDir,
log("NO " + what + " to remove from " + toDir,
Project.MSG_VERBOSE);
}
}


+ 10
- 10
src/main/org/apache/tools/ant/taskdefs/Tar.java View File

@@ -219,7 +219,7 @@ public class Tar extends MatchingTask {
public void setCompression(TarCompressionMethod mode) {
this.compression = mode;
}
/**
* do the business
*/
@@ -336,7 +336,7 @@ public class Tar extends MatchingTask {
filesets = savedFileSets;
}
}
/**
* tar a file
*/
@@ -489,12 +489,12 @@ public class Tar extends MatchingTask {
}

/**
* A 3 digit octal string, specify the user, group and
* other modes in the standard Unix fashion;
* A 3 digit octal string, specify the user, group and
* other modes in the standard Unix fashion;
* optional, default=0644
*/
public void setMode(String octalString) {
this.fileMode =
this.fileMode =
UnixStat.FILE_FLAG | Integer.parseInt(octalString, 8);
}

@@ -503,14 +503,14 @@ public class Tar extends MatchingTask {
}

/**
* A 3 digit octal string, specify the user, group and
* other modes in the standard Unix fashion;
* A 3 digit octal string, specify the user, group and
* other modes in the standard Unix fashion;
* optional, default=0755
*
* @since Ant 1.6
*/
public void setDirMode(String octalString) {
this.dirMode =
this.dirMode =
UnixStat.DIR_FLAG | Integer.parseInt(octalString, 8);
}

@@ -522,7 +522,7 @@ public class Tar extends MatchingTask {
}

/**
* The username for the tar entry
* The username for the tar entry
* This is not the same as the UID, which is
* not currently set by the task.
*/
@@ -589,7 +589,7 @@ public class Tar extends MatchingTask {
}

/**
* Set of options for long file handling in the task.
* Set of options for long file handling in the task.
*
* @author Magesh Umasankar
*/


+ 11
- 11
src/main/org/apache/tools/ant/taskdefs/Touch.java View File

@@ -77,7 +77,7 @@ import org.apache.tools.ant.util.JavaEnvUtils;
* <p>Note: Setting the modification time of files is not supported in
* JDK 1.1.</p>
*
* @author Stefan Bodewig
* @author Stefan Bodewig
* @author <a href="mailto:mj@servidium.com">Michael J. Sikorsky</a>
* @author <a href="mailto:shaw@servidium.com">Robert Shaw</a>
*
@@ -87,7 +87,7 @@ import org.apache.tools.ant.util.JavaEnvUtils;
*/
public class Touch extends Task {

private File file;
private File file;
private long millis = -1;
private String dateTime;
private Vector filesets = new Vector();
@@ -116,7 +116,7 @@ public class Touch extends Task {

/**
* the new modification time of the file
* in the format &quot;MM/DD/YYYY HH:MM AM <i>or</i> PM&quot;
* in the format &quot;MM/DD/YYYY HH:MM AM <i>or</i> PM&quot;
* or &quot;MM/DD/YYYY HH:MM:SS AM <i>or</i> PM&quot;.
* Optional, default=now
*/
@@ -138,7 +138,7 @@ public class Touch extends Task {
long savedMillis = millis;

if (file == null && filesets.size() == 0) {
throw
throw
new BuildException("Specify at least one source - a file or "
+ "a fileset.");
}
@@ -159,21 +159,21 @@ public class Touch extends Task {
* that fails with MEDIUM - throw an exception if both
* fail.
*/
DateFormat df =
DateFormat df =
DateFormat.getDateTimeInstance(DateFormat.SHORT,
DateFormat.SHORT,
Locale.US);
try {
setMillis(df.parse(dateTime).getTime());
} catch (ParseException pe) {
df =
df =
DateFormat.getDateTimeInstance(DateFormat.SHORT,
DateFormat.MEDIUM,
Locale.US);
try {
setMillis(df.parse(dateTime).getTime());
} catch (ParseException pe2) {
throw new BuildException(pe2.getMessage(), pe,
throw new BuildException(pe2.getMessage(), pe,
getLocation());
}
}
@@ -204,18 +204,18 @@ public class Touch extends Task {
try {
fileUtils.createNewFile(file);
} catch (IOException ioe) {
throw new BuildException("Could not create " + file, ioe,
throw new BuildException("Could not create " + file, ioe,
getLocation());
}
}
}

if (millis >= 0 &&
if (millis >= 0 &&
JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) {
log("modification time of files cannot be set in JDK 1.1",
Project.MSG_WARN);
return;
}
}

boolean resetMillis = false;
if (millis < 0) {
@@ -239,7 +239,7 @@ public class Touch extends Task {
for (int j = 0; j < srcFiles.length ; j++) {
touch(new File(fromDir, srcFiles[j]));
}
for (int j = 0; j < srcDirs.length ; j++) {
touch(new File(fromDir, srcDirs[j]));
}


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Transform.java View File

@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/Typedef.java View File

@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -74,7 +74,7 @@ package org.apache.tools.ant.taskdefs;
* types are things likepaths or filesets that can be defined at
* the project level and referenced via their ID attribute.</p>
* <p>Custom data types usually need custom tasks to put them to good use.</p>
*
*
* @author Stefan Bodewig
* @since Ant 1.4
* @ant.task category="internal"


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Untar.java View File

@@ -118,7 +118,7 @@ public class Untar extends Expand {
* @since Ant 1.6
*/
public void setEncoding(String encoding) {
throw new BuildException("The " + getTaskName()
throw new BuildException("The " + getTaskName()
+ " task doesn't support the encoding"
+ " attribute", getLocation());
}


+ 9
- 9
src/main/org/apache/tools/ant/taskdefs/UpToDate.java View File

@@ -72,9 +72,9 @@ import org.apache.tools.ant.util.SourceFileScanner;
* Sets the given property if the specified target has a timestamp
* greater than all of the source files.
*
* @author William Ferguson
* <a href="mailto:williamf@mincom.com">williamf@mincom.com</a>
* @author Hiroaki Nakamura
* @author William Ferguson
* <a href="mailto:williamf@mincom.com">williamf@mincom.com</a>
* @author Hiroaki Nakamura
* <a href="mailto:hnakamur@mc.neweb.ne.jp">hnakamur@mc.neweb.ne.jp</a>
* @author Stefan Bodewig
* @author <a href="http://nerdmonkey.com">Eli Tucker</a>
@@ -119,7 +119,7 @@ public class UpToDate extends Task implements Condition {
*/
private String getValue() {
return (_value != null) ? _value : "true";
}
}

/**
* The file which must be more up-to-date than (each of) the source file(s)
@@ -183,14 +183,14 @@ public class UpToDate extends Task implements Condition {

// if the target file is not there, then it can't be up-to-date
if (_targetFile != null && !_targetFile.exists()) {
log("The targetfile \"" + _targetFile.getAbsolutePath()
log("The targetfile \"" + _targetFile.getAbsolutePath()
+ "\" does not exist.", Project.MSG_VERBOSE);
return false;
}
}

// if the source file isn't there, throw an exception
if (_sourceFile != null && !_sourceFile.exists()) {
throw new BuildException(_sourceFile.getAbsolutePath()
throw new BuildException(_sourceFile.getAbsolutePath()
+ " not found.");
}

@@ -226,14 +226,14 @@ public class UpToDate extends Task implements Condition {
*/
public void execute() throws BuildException {
if (_property == null) {
throw new BuildException("property attribute is required.",
throw new BuildException("property attribute is required.",
getLocation());
}
boolean upToDate = eval();
if (upToDate) {
this.getProject().setNewProperty(_property, getValue());
if (mapperElement == null) {
log("File \"" + _targetFile.getAbsolutePath()
log("File \"" + _targetFile.getAbsolutePath()
+ "\" is up-to-date.", Project.MSG_VERBOSE);
} else {
log("All target files are up-to-date.",


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/WaitFor.java View File

@@ -172,7 +172,7 @@ public class WaitFor extends ConditionBase {
}

/**
* The enumeration of units:
* The enumeration of units:
* millisecond, second, minute, hour, day, week
* @todo we use timestamps in many places, why not factor this out
*/


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/War.java View File

@@ -174,7 +174,7 @@ public class War extends Jar {
/**
* Overriden from Zip class to deal with web.xml
*/
protected void zipFile(File file, ZipOutputStream zOut, String vPath,
protected void zipFile(File file, ZipOutputStream zOut, String vPath,
int mode)
throws IOException {
// If the file being added is WEB-INF/web.xml, we warn if it's


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java View File

@@ -112,8 +112,8 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {

/** Classpath to use when trying to load the XSL processor */
private Path classpath = null;
/** The Liason implementation to use to communicate with the XSL
/** The Liason implementation to use to communicate with the XSL
* processor */
private XSLTLiaison liaison;



+ 14
- 14
src/main/org/apache/tools/ant/taskdefs/XmlProperty.java View File

@@ -264,7 +264,7 @@ public class XmlProperty extends org.apache.tools.ant.Task {

try {
log("Loading " + src.getAbsolutePath(), Project.MSG_VERBOSE);
if (src.exists()) {

configurationStream =
@@ -297,7 +297,7 @@ public class XmlProperty extends org.apache.tools.ant.Task {
log("Unable to find property file: " + src.getAbsolutePath(),
Project.MSG_VERBOSE);
}
} catch (SAXException sxe) {
// Error generated during parsing
Exception x = sxe;
@@ -322,7 +322,7 @@ public class XmlProperty extends org.apache.tools.ant.Task {
}

/** Iterate through all nodes in the tree. */
private void addNodeRecursively(Node node, String prefix,
private void addNodeRecursively(Node node, String prefix,
Object container) {

// Set the prefix for this node to include its tag name.
@@ -347,7 +347,7 @@ public class XmlProperty extends org.apache.tools.ant.Task {
// For each child, pass the object added by
// processNode to its children -- in other word, each
// object can pass information along to its children.
addNodeRecursively(nodeChildren.item(i), nodePrefix,
addNodeRecursively(nodeChildren.item(i), nodePrefix,
nodeObject);
}
}
@@ -389,7 +389,7 @@ public class XmlProperty extends org.apache.tools.ant.Task {

// Is there an id attribute?
Node idNode = nodeAttributes.getNamedItem(ID);
id = (semanticAttributes && idNode != null
id = (semanticAttributes && idNode != null
? idNode.getNodeValue() : null);

// Now, iterate through the attributes adding them.
@@ -406,8 +406,8 @@ public class XmlProperty extends org.apache.tools.ant.Task {
String nodeName = attributeNode.getNodeName();
String attributeValue = getAttributeValue(attributeNode);

Path containingPath =
(container != null && container instanceof Path
Path containingPath =
(container != null && container instanceof Path
? (Path) container : null );

/*
@@ -419,15 +419,15 @@ public class XmlProperty extends org.apache.tools.ant.Task {
if (nodeName.equals(ID)) {
// ID has already been found above.
continue;
} else if (containingPath != null
} else if (containingPath != null
&& nodeName.equals(PATH)) {
// A "path" attribute for a node within a Path object.
containingPath.setPath(attributeValue);
} else if (container instanceof Path
} else if (container instanceof Path
&& nodeName.equals(REF_ID)) {
// A "refid" attribute for a node within a Path object.
containingPath.setPath(attributeValue);
} else if (container instanceof Path
} else if (container instanceof Path
&& nodeName.equals(LOCATION)) {
// A "location" attribute for a node within a
// Path object.
@@ -454,16 +454,16 @@ public class XmlProperty extends org.apache.tools.ant.Task {
if (node.getNodeType() == Node.TEXT_NODE) {
// For the text node, add a property.
nodeText = getAttributeValue(node);
} else if ((node.getNodeType() == Node.ELEMENT_NODE)
} else if ((node.getNodeType() == Node.ELEMENT_NODE)
&& (node.getChildNodes().getLength() == 1)
&& (node.getFirstChild().getNodeType() == Node.CDATA_SECTION_NODE)) {

nodeText = node.getFirstChild().getNodeValue();
}
if (nodeText != null) {
// If the containing object was a String, then use it as the ID.
if (semanticAttributes && id == null
if (semanticAttributes && id == null
&& container instanceof String) {
id = (String) container;
System.out.println("Setting id = " + id);
@@ -528,7 +528,7 @@ public class XmlProperty extends org.apache.tools.ant.Task {
if (attributeName.equals(REF_ID)) {
return "";
// Otherwise, return it appended unless property to hide it is set.
} else if (!isSemanticAttribute(attributeName)
} else if (!isSemanticAttribute(attributeName)
|| includeSemanticAttribute) {
return "." + attributeName;
} else {


+ 30
- 30
src/main/org/apache/tools/ant/taskdefs/Zip.java View File

@@ -436,7 +436,7 @@ public class Zip extends MatchingTask {
addResources(fss[i], addThem[i], zOut);
}
}
if (doUpdate) {
addingNewFiles = false;
ZipFileSet oldFiles = new ZipFileSet();
@@ -447,7 +447,7 @@ public class Zip extends MatchingTask {
PatternSet.NameEntry ne = oldFiles.createExclude();
ne.setName((String) addedFiles.elementAt(i));
}
DirectoryScanner ds =
DirectoryScanner ds =
oldFiles.getDirectoryScanner(getProject());
((ZipScanner) ds).setEncoding(encoding);
String[] f = ds.getIncludedFiles();
@@ -455,7 +455,7 @@ public class Zip extends MatchingTask {
for (int i = 0; i < f.length; i++) {
r[i] = ds.getResource(f[i]);
}
addResources(oldFiles, r, zOut);
}
finalizeZipOutputStream(zOut);
@@ -580,7 +580,7 @@ public class Zip extends MatchingTask {
} else {
zf = new ZipFile(zfs.getSrc(getProject()), encoding);
}
for (int i = 0; i < resources.length; i++) {
String name = null;
if (fullpath.length() > 0) {
@@ -589,26 +589,26 @@ public class Zip extends MatchingTask {
name = resources[i].getName();
}
name = name.replace(File.separatorChar, '/');
if ("".equals(name)) {
continue;
}
if (resources[i].isDirectory() && ! name.endsWith("/")) {
name = name + "/";
}
addParentDirs(base, name, zOut, prefix, dirMode);

if (!resources[i].isDirectory() && dealingWithFiles) {
File f = fileUtils.resolveFile(base,
File f = fileUtils.resolveFile(base,
resources[i].getName());
zipFile(f, zOut, prefix + name, fileMode);
} else if (!resources[i].isDirectory()) {
ZipEntry ze = zf.getEntry(resources[i].getName());
if (ze != null) {
zipFile(zf.getInputStream(ze), zOut, prefix + name,
ze.getTime(), zfs.getSrc(getProject()),
zfs.hasFileModeBeenSet() ? fileMode
zipFile(zf.getInputStream(ze), zOut, prefix + name,
ze.getTime(), zfs.getSrc(getProject()),
zfs.hasFileModeBeenSet() ? fileMode
: ze.getUnixMode());
}
}
@@ -734,18 +734,18 @@ public class Zip extends MatchingTask {

if (emptyBehavior.equals("skip")) {
if (doUpdate) {
log(archiveType + " archive " + zipFile
+ " not updated because no new files were included.",
log(archiveType + " archive " + zipFile
+ " not updated because no new files were included.",
Project.MSG_VERBOSE);
} else {
log("Warning: skipping " + archiveType + " archive "
+ zipFile + " because no files were included.",
log("Warning: skipping " + archiveType + " archive "
+ zipFile + " because no files were included.",
Project.MSG_WARN);
}
} else if (emptyBehavior.equals("fail")) {
throw new BuildException("Cannot create " + archiveType
+ " archive " + zipFile +
": no files were included.",
": no files were included.",
getLocation());
} else {
// Create.
@@ -768,13 +768,13 @@ public class Zip extends MatchingTask {
Resource[][] newerResources = new Resource[filesets.length][];

for (int i = 0; i < filesets.length; i++) {
if (!(fileset instanceof ZipFileSet)
if (!(fileset instanceof ZipFileSet)
|| ((ZipFileSet) fileset).getSrc(getProject()) == null) {
File base = filesets[i].getDir(getProject());
for (int j = 0; j < initialResources[i].length; j++) {
File resourceAsFile =
fileUtils.resolveFile(base,
File resourceAsFile =
fileUtils.resolveFile(base,
initialResources[i][j].getName());
if (resourceAsFile.equals(zipFile)) {
throw new BuildException("A zip file cannot include "
@@ -789,7 +789,7 @@ public class Zip extends MatchingTask {
newerResources[i] = new Resource[] {};
continue;
}
FileNameMapper myMapper = new IdentityMapper();
if (filesets[i] instanceof ZipFileSet) {
ZipFileSet zfs = (ZipFileSet) filesets[i];
@@ -819,8 +819,8 @@ public class Zip extends MatchingTask {
if (doFilesonly) {
resources = selectFileResources(resources);
}
newerResources[i] =
newerResources[i] =
ResourceUtils.selectOutOfDateSources(this,
resources,
myMapper,
@@ -838,21 +838,21 @@ public class Zip extends MatchingTask {
// we are recreating the archive, need all resources
return new ArchiveState(true, initialResources);
}
return new ArchiveState(needsUpdate, newerResources);
}

/**
* Fetch all included and not excluded resources from the sets.
*
* <p>Included directories will preceede included files.</p>
* <p>Included directories will preceede included files.</p>
*
* @since Ant 1.5.2
*/
protected Resource[][] grabResources(FileSet[] filesets) {
Resource[][] result = new Resource[filesets.length][];
for (int i = 0; i < filesets.length; i++) {
DirectoryScanner rs =
DirectoryScanner rs =
filesets[i].getDirectoryScanner(getProject());
if (rs instanceof ZipScanner) {
((ZipScanner) rs).setEncoding(encoding);
@@ -866,7 +866,7 @@ public class Zip extends MatchingTask {
for (int j = 0; j < files.length; j++) {
resources.addElement(rs.getResource(files[j]));
}
result[i] = new Resource[resources.size()];
resources.copyInto(result[i]);
}
@@ -1017,7 +1017,7 @@ public class Zip extends MatchingTask {
*
* @since Ant 1.5.2
*/
protected void zipFile(File file, ZipOutputStream zOut, String vPath,
protected void zipFile(File file, ZipOutputStream zOut, String vPath,
int mode)
throws IOException {
if (file.equals(zipFile)) {
@@ -1120,7 +1120,7 @@ public class Zip extends MatchingTask {

/**
* @return true if all individual arrays are empty
*
*
* @since Ant 1.5.2
*/
protected final static boolean isEmpty(Resource[][] r) {
@@ -1141,13 +1141,13 @@ public class Zip extends MatchingTask {
if (orig.length == 0) {
return orig;
}
Vector v = new Vector(orig.length);
for (int i = 0; i < orig.length; i++) {
if (!orig[i].isDirectory()) {
v.addElement(orig[i]);
} else {
log("Ignoring directory " + orig[i].getName()
log("Ignoring directory " + orig[i].getName()
+ " as only files will be added.", Project.MSG_VERBOSE);
}
}


Loading…
Cancel
Save