diff --git a/src/main/org/apache/tools/ant/AntClassLoader.java b/src/main/org/apache/tools/ant/AntClassLoader.java index 5083f82e1..63e730685 100644 --- a/src/main/org/apache/tools/ant/AntClassLoader.java +++ b/src/main/org/apache/tools/ant/AntClassLoader.java @@ -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 + } } } diff --git a/src/main/org/apache/tools/ant/BuildEvent.java b/src/main/org/apache/tools/ant/BuildEvent.java index 694753c76..a20e67723 100644 --- a/src/main/org/apache/tools/ant/BuildEvent.java +++ b/src/main/org/apache/tools/ant/BuildEvent.java @@ -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 null. * @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 null. * @@ -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 null * 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 null * 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 null * 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 * null if no exception has been set. * * @see BuildListener#taskFinished(BuildEvent) diff --git a/src/main/org/apache/tools/ant/BuildListener.java b/src/main/org/apache/tools/ant/BuildListener.java index cd5dba9bc..2cd7451bf 100644 --- a/src/main/org/apache/tools/ant/BuildListener.java +++ b/src/main/org/apache/tools/ant/BuildListener.java @@ -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 null. */ @@ -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 null. * @@ -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 null. * @@ -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 null. * @@ -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 null. * @@ -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 null. * diff --git a/src/main/org/apache/tools/ant/BuildLogger.java b/src/main/org/apache/tools/ant/BuildLogger.java index 2727dc5dc..7fb88178c 100644 --- a/src/main/org/apache/tools/ant/BuildLogger.java +++ b/src/main/org/apache/tools/ant/BuildLogger.java @@ -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 System.out unless redirected by + * A build logger is a build listener which has the 'right' to send output to + * the ant log, which is usually System.out unless redirected by * the -logfile 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. *

- * Constants for the message levels are in the - * {@link Project Project} class. The order of the levels, from least - * to most verbose, is MSG_ERR, MSG_WARN, - * MSG_INFO, MSG_VERBOSE, + * Constants for the message levels are in the + * {@link Project Project} class. The order of the levels, from least + * to most verbose, is MSG_ERR, MSG_WARN, + * MSG_INFO, MSG_VERBOSE, * MSG_DEBUG. * * @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 null. */ 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 null. */ - void setErrorPrintStream(PrintStream err); + void setErrorPrintStream(PrintStream err); } diff --git a/src/main/org/apache/tools/ant/ComponentHelper.java b/src/main/org/apache/tools/ant/ComponentHelper.java index bc84c2930..010b9cc6b 100644 --- a/src/main/org/apache/tools/ant/ComponentHelper.java +++ b/src/main/org/apache/tools/ant/ComponentHelper.java @@ -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 diff --git a/src/main/org/apache/tools/ant/DefaultLogger.java b/src/main/org/apache/tools/ant/DefaultLogger.java index ab91f03bb..5cd0e651a 100644 --- a/src/main/org/apache/tools/ant/DefaultLogger.java +++ b/src/main/org/apache/tools/ant/DefaultLogger.java @@ -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. *

- * Constants for the message levels are in the - * {@link Project Project} class. The order of the levels, from least - * to most verbose, is MSG_ERR, MSG_WARN, - * MSG_INFO, MSG_VERBOSE, + * Constants for the message levels are in the + * {@link Project Project} class. The order of the levels, from least + * to most verbose, is MSG_ERR, MSG_WARN, + * MSG_INFO, MSG_VERBOSE, * MSG_DEBUG. *

* 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 null. */ @@ -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 null. */ 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 null. */ @@ -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 null. - * @param stream A PrintStream to print the message to. + * @param stream A PrintStream to print the message to. * Must not be null. - * @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 null. */ - protected void log(String message) {} + protected void log(String message) { + } } diff --git a/src/main/org/apache/tools/ant/DemuxInputStream.java b/src/main/org/apache/tools/ant/DemuxInputStream.java index d2c157dcc..08313acad 100644 --- a/src/main/org/apache/tools/ant/DemuxInputStream.java +++ b/src/main/org/apache/tools/ant/DemuxInputStream.java @@ -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) diff --git a/src/main/org/apache/tools/ant/DemuxOutputStream.java b/src/main/org/apache/tools/ant/DemuxOutputStream.java index f6e49900f..ae4cd486b 100644 --- a/src/main/org/apache/tools/ant/DemuxOutputStream.java +++ b/src/main/org/apache/tools/ant/DemuxOutputStream.java @@ -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 null. - * @param isErrorStream true if this is the error string, - * otherwise a normal output stream. This is + * @param isErrorStream true 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 { diff --git a/src/main/org/apache/tools/ant/Diagnostics.java b/src/main/org/apache/tools/ant/Diagnostics.java index 7c4a5e3e5..de2ddddd4 100644 --- a/src/main/org/apache/tools/ant/Diagnostics.java +++ b/src/main/org/apache/tools/ant/Diagnostics.java @@ -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 * null 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()); } } diff --git a/src/main/org/apache/tools/ant/DirectoryScanner.java b/src/main/org/apache/tools/ant/DirectoryScanner.java index 0f8b45ab5..f374a31bd 100644 --- a/src/main/org/apache/tools/ant/DirectoryScanner.java +++ b/src/main/org/apache/tools/ant/DirectoryScanner.java @@ -152,7 +152,7 @@ import org.apache.tools.ant.util.FileUtils; * @author Bruce Atherton * @author Antoine Levy-Lambert */ -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 String based on the current - * contents of the defaultExcludes + * @return An array of String based on the current + * contents of the defaultExcludes * Vector. * * @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 true if the string was added + * @return true if the string was added * false 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 true if s was a default + * @return true if s was a default * exclude (and thus was removed), * false if s 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()); } diff --git a/src/main/org/apache/tools/ant/DynamicConfigurator.java b/src/main/org/apache/tools/ant/DynamicConfigurator.java index edd400c26..34751bfa0 100644 --- a/src/main/org/apache/tools/ant/DynamicConfigurator.java +++ b/src/main/org/apache/tools/ant/DynamicConfigurator.java @@ -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; } diff --git a/src/main/org/apache/tools/ant/FileScanner.java b/src/main/org/apache/tools/ant/FileScanner.java index ea1edb27d..1b32cd0e1 100644 --- a/src/main/org/apache/tools/ant/FileScanner.java +++ b/src/main/org/apache/tools/ant/FileScanner.java @@ -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 null, 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 * File.separatorChar, so the separator used need not match * File.separatorChar. * - * @param basedir The base directory to scan. + * @param basedir The base directory to scan. * Must not be null. */ 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 null. */ void setBasedir(File basedir); - + /** * Sets the list of exclude patterns to use. * - * @param excludes A list of exclude patterns. - * May be null, indicating that no files - * should be excluded. If a non-null list is + * @param excludes A list of exclude patterns. + * May be null, indicating that no files + * should be excluded. If a non-null list is * given, all elements must be non-null. - */ + */ void setExcludes(String[] excludes); - + /** * Sets the list of include patterns to use. * * @param includes A list of include patterns. - * May be null, indicating that all files + * May be null, indicating that all files * should be included. If a non-null - * list is given, all elements must be + * list is given, all elements must be * non-null. */ 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); diff --git a/src/main/org/apache/tools/ant/IntrospectionHelper.java b/src/main/org/apache/tools/ant/IntrospectionHelper.java index b8dd4d1e2..730f65cc1 100644 --- a/src/main/org/apache/tools/ant/IntrospectionHelper.java +++ b/src/main/org/apache/tools/ant/IntrospectionHelper.java @@ -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]; diff --git a/src/main/org/apache/tools/ant/Location.java b/src/main/org/apache/tools/ant/Location.java index 615c14f86..15100370d 100644 --- a/src/main/org/apache/tools/ant/Location.java +++ b/src/main/org/apache/tools/ant/Location.java @@ -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 null, * 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 null. * * @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 null, * 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 "fileName: lineNumber: " * if both file name and line number are known, * "fileName: " if only the file name is known, diff --git a/src/main/org/apache/tools/ant/Main.java b/src/main/org/apache/tools/ant/Main.java index bd4d0e133..54bd9cae8 100644 --- a/src/main/org/apache/tools/ant/Main.java +++ b/src/main/org/apache/tools/ant/Main.java @@ -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)); diff --git a/src/main/org/apache/tools/ant/NoBannerLogger.java b/src/main/org/apache/tools/ant/NoBannerLogger.java index 2cc9f3aa2..72af036b1 100644 --- a/src/main/org/apache/tools/ant/NoBannerLogger.java +++ b/src/main/org/apache/tools/ant/NoBannerLogger.java @@ -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 null after the first message for + * to null 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 null. */ @@ -87,9 +87,9 @@ public class NoBannerLogger extends DefaultLogger { targetName = event.getTarget().getName(); } - /** + /** * Resets the current target name to null. - * + * * @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 null. */ public void messageLogged(BuildEvent event) { - if (event.getPriority() > msgOutputLevel - || null == event.getMessage() + if (event.getPriority() > msgOutputLevel + || null == event.getMessage() || "".equals(event.getMessage().trim())) { return; } diff --git a/src/main/org/apache/tools/ant/PathTokenizer.java b/src/main/org/apache/tools/ant/PathTokenizer.java index fed063c17..2ff6b6110 100644 --- a/src/main/org/apache/tools/ant/PathTokenizer.java +++ b/src/main/org/apache/tools/ant/PathTokenizer.java @@ -66,14 +66,14 @@ import org.apache.tools.ant.taskdefs.condition.Os; * of either '/' or '\'. * * @author Conor MacNeill - * @author Jeff Tulley - */ + * @author Jeff Tulley + */ 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 null. */ 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 true, then a subsequent call + * path. If this method returns true, then a subsequent call * to nextToken will successfully return a token. - * - * @return true if and only if there is at least one token + * + * @return true if and only if there is at least one token * in the string after the current position; false 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; } } - + diff --git a/src/main/org/apache/tools/ant/ProjectComponent.java b/src/main/org/apache/tools/ant/ProjectComponent.java index d20050ea8..5c4f0e2c0 100644 --- a/src/main/org/apache/tools/ant/ProjectComponent.java +++ b/src/main/org/apache/tools/ant/ProjectComponent.java @@ -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 null. - * @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) { diff --git a/src/main/org/apache/tools/ant/RuntimeConfigurable.java b/src/main/org/apache/tools/ant/RuntimeConfigurable.java index fb6f78c9a..02de7b025 100644 --- a/src/main/org/apache/tools/ant/RuntimeConfigurable.java +++ b/src/main/org/apache/tools/ant/RuntimeConfigurable.java @@ -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/**/ 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/**/ attributeNames = null; - + /** Map of attribute names to values */ private Map/**/ 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. * diff --git a/src/main/org/apache/tools/ant/Target.java b/src/main/org/apache/tools/ant/Target.java index 44f9aab7e..a6de5acc2 100644 --- a/src/main/org/apache/tools/ant/Target.java +++ b/src/main/org/apache/tools/ant/Target.java @@ -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 null. */ 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 null if + * + * @return The project this target belongs to, or null 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 null. */ @@ -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 null. */ 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 null 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 null. */ 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 null. */ 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 null. */ @@ -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 foo has value bar, setting * the "if" condition to ${foo}_x will mean that the * task will only execute if property bar_x is set. - * + * * @param property The property condition to test on execution. * May be null, 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 foo has value bar, setting * the "unless" condition to ${foo}_x will mean that the * task will only execute if property bar_x isn't set. - * + * * @param property The property condition to test on execution. * May be null, 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 null, indicating that no + * + * @param description The description for this target. + * May be null, 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 null 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 null 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 null. * @param o The data type wrapper to replace el 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 null. * @param o The task to replace el 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, * true 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, * true is returned. diff --git a/src/main/org/apache/tools/ant/Task.java b/src/main/org/apache/tools/ant/Task.java index 4b3a7ae36..357088244 100644 --- a/src/main/org/apache/tools/ant/Task.java +++ b/src/main/org/apache/tools/ant/Task.java @@ -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 diff --git a/src/main/org/apache/tools/ant/TaskAdapter.java b/src/main/org/apache/tools/ant/TaskAdapter.java index 55a56e107..fa7e877d9 100644 --- a/src/main/org/apache/tools/ant/TaskAdapter.java +++ b/src/main/org/apache/tools/ant/TaskAdapter.java @@ -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 null. - * @param project Project to log warnings/errors to. + * @param project Project to log warnings/errors to. * Must not be null. - * + * * @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 null. */ 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() { diff --git a/src/main/org/apache/tools/ant/UnknownElement.java b/src/main/org/apache/tools/ant/UnknownElement.java index 049a44b71..bd77b8ca8 100644 --- a/src/main/org/apache/tools/ant/UnknownElement.java +++ b/src/main/org/apache/tools/ant/UnknownElement.java @@ -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) { diff --git a/src/main/org/apache/tools/ant/XmlLogger.java b/src/main/org/apache/tools/ant/XmlLogger.java index 921634d41..25aede998 100644 --- a/src/main/org/apache/tools/ant/XmlLogger.java +++ b/src/main/org/apache/tools/ant/XmlLogger.java @@ -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) { diff --git a/src/main/org/apache/tools/ant/filters/BaseFilterReader.java b/src/main/org/apache/tools/ant/filters/BaseFilterReader.java index 5c141fd7f..8070e0b3b 100644 --- a/src/main/org/apache/tools/ant/filters/BaseFilterReader.java +++ b/src/main/org/apache/tools/ant/filters/BaseFilterReader.java @@ -95,7 +95,7 @@ public abstract class BaseFilterReader * * @param in A Reader object providing the underlying stream. * Must not be null. - * + * */ 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 null. * @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 n 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 null. */ 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 null 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 { diff --git a/src/main/org/apache/tools/ant/filters/BaseParamFilterReader.java b/src/main/org/apache/tools/ant/filters/BaseParamFilterReader.java index 33180ffaa..f503ad8e4 100644 --- a/src/main/org/apache/tools/ant/filters/BaseParamFilterReader.java +++ b/src/main/org/apache/tools/ant/filters/BaseParamFilterReader.java @@ -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 null. */ @@ -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() { diff --git a/src/main/org/apache/tools/ant/filters/ChainableReader.java b/src/main/org/apache/tools/ant/filters/ChainableReader.java index 1d5c92224..7320a0cb9 100644 --- a/src/main/org/apache/tools/ant/filters/ChainableReader.java +++ b/src/main/org/apache/tools/ant/filters/ChainableReader.java @@ -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); } diff --git a/src/main/org/apache/tools/ant/filters/ClassConstants.java b/src/main/org/apache/tools/ant/filters/ClassConstants.java index 62aadb957..1934e4bdd 100644 --- a/src/main/org/apache/tools/ant/filters/ClassConstants.java +++ b/src/main/org/apache/tools/ant/filters/ClassConstants.java @@ -76,7 +76,8 @@ import java.lang.reflect.Method; * Example:
*

<classconstants/>
* Or: - *
<filterreader classname="org.apache.tools.ant.filters.ClassConstants"/>
+ *
<filterreader
+ *    classname="org.apache.tools.ant.filters.ClassConstants"/>
* @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 null. - * + * * @return a new filter based on this configuration, but filtering * the specified reader */ diff --git a/src/main/org/apache/tools/ant/filters/EscapeUnicode.java b/src/main/org/apache/tools/ant/filters/EscapeUnicode.java index 2d6339774..61c214a6e 100644 --- a/src/main/org/apache/tools/ant/filters/EscapeUnicode.java +++ b/src/main/org/apache/tools/ant/filters/EscapeUnicode.java @@ -66,7 +66,7 @@ import org.apache.tools.ant.types.Parameter; * * Or: * - *
<filterreader 
+ * 
<filterreader
         classname="org.apache.tools.ant.filters.EscapeUnicode"/>
  *  
* @@ -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++) { - } - } } } diff --git a/src/main/org/apache/tools/ant/filters/ExpandProperties.java b/src/main/org/apache/tools/ant/filters/ExpandProperties.java index 463aee772..a21abf7b7 100644 --- a/src/main/org/apache/tools/ant/filters/ExpandProperties.java +++ b/src/main/org/apache/tools/ant/filters/ExpandProperties.java @@ -63,8 +63,9 @@ import org.apache.tools.ant.Project; * Example:
*
<expandproperties/>
* Or: - *
<filterreader classname="org.apache.tools.ant.filters.ExpandProperties"/>
- * + *
<filterreader
+ *    classname="org.apache.tools.ant.filters.ExpandProperties"/>
+ * * @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 null. - * + * * @return a new filter based on this configuration, but filtering * the specified reader */ diff --git a/src/main/org/apache/tools/ant/filters/HeadFilter.java b/src/main/org/apache/tools/ant/filters/HeadFilter.java index 5584a744f..5ce2871fa 100644 --- a/src/main/org/apache/tools/ant/filters/HeadFilter.java +++ b/src/main/org/apache/tools/ant/filters/HeadFilter.java @@ -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; diff --git a/src/main/org/apache/tools/ant/filters/LineContainsRegExp.java b/src/main/org/apache/tools/ant/filters/LineContainsRegExp.java index 67d8fd2e6..57b584198 100644 --- a/src/main/org/apache/tools/ant/filters/LineContainsRegExp.java +++ b/src/main/org/apache/tools/ant/filters/LineContainsRegExp.java @@ -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 regexp element. - * - * @param regExp The regexp element to add. + * + * @param regExp The regexp element to add. * Must not be null. */ 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 * null. */ 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 null. - * + * * @return a new filter based on this configuration, but filtering * the specified reader */ diff --git a/src/main/org/apache/tools/ant/filters/PrefixLines.java b/src/main/org/apache/tools/ant/filters/PrefixLines.java index 8c7b90fb4..25ada34d1 100644 --- a/src/main/org/apache/tools/ant/filters/PrefixLines.java +++ b/src/main/org/apache/tools/ant/filters/PrefixLines.java @@ -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 null, 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 null. - * + * * @return a new filter based on this configuration, but filtering * the specified reader */ diff --git a/src/main/org/apache/tools/ant/filters/ReplaceTokens.java b/src/main/org/apache/tools/ant/filters/ReplaceTokens.java index 1a3dc8126..e7f7f4af7 100644 --- a/src/main/org/apache/tools/ant/filters/ReplaceTokens.java +++ b/src/main/org/apache/tools/ant/filters/ReplaceTokens.java @@ -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 null. */ @@ -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 null. */ @@ -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 null. - * + * * @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 null. */ 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 null. */ 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() { diff --git a/src/main/org/apache/tools/ant/filters/StripLineBreaks.java b/src/main/org/apache/tools/ant/filters/StripLineBreaks.java index fb63bd18a..48ba73266 100644 --- a/src/main/org/apache/tools/ant/filters/StripLineBreaks.java +++ b/src/main/org/apache/tools/ant/filters/StripLineBreaks.java @@ -59,7 +59,7 @@ import org.apache.tools.ant.types.Parameter; /** * Filter to flatten the stream to a single line. - * + * * Example: * *
<striplinebreaks/>
@@ -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 null. - * + * * @return a new filter based on this configuration, but filtering * the specified reader */ diff --git a/src/main/org/apache/tools/ant/filters/StripLineComments.java b/src/main/org/apache/tools/ant/filters/StripLineComments.java index 1caf7dfe2..17aa8bb1c 100644 --- a/src/main/org/apache/tools/ant/filters/StripLineComments.java +++ b/src/main/org/apache/tools/ant/filters/StripLineComments.java @@ -73,7 +73,7 @@ import org.apache.tools.ant.types.Parameter; * * Or: * - *
<filterreader 
+ * 
<filterreader
  *      classname="org.apache.tools.ant.filters.StripLineComments">
  *   <param type="comment" value="#"/>
  *   <param type="comment" value="--"/>
@@ -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 comment element to the list of prefixes.
-     * 
+     *
      * @param comment The comment element to add to the
      * list of comment prefixes to strip. Must not be null.
      */
@@ -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 null.
      */
@@ -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 null.
-     * 
+     *
      * @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 null.
          */
@@ -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() {
diff --git a/src/main/org/apache/tools/ant/filters/TabsToSpaces.java b/src/main/org/apache/tools/ant/filters/TabsToSpaces.java
index 5532e0fd1..0bd296f69 100644
--- a/src/main/org/apache/tools/ant/filters/TabsToSpaces.java
+++ b/src/main/org/apache/tools/ant/filters/TabsToSpaces.java
@@ -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 null.
-     * 
+     *
      * @return a new filter based on this configuration, but filtering
      *         the specified reader
      */
diff --git a/src/main/org/apache/tools/ant/filters/TailFilter.java b/src/main/org/apache/tools/ant/filters/TailFilter.java
index 276262f62..93f78c4b8 100644
--- a/src/main/org/apache/tools/ant/filters/TailFilter.java
+++ b/src/main/org/apache/tools/ant/filters/TailFilter.java
@@ -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.
      *
diff --git a/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java b/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java
index a2c1297e0..27393b57b 100644
--- a/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java
+++ b/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java
@@ -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
  *         wwerner@picturesafe.de
- * @author Kevin Ross 
+ * @author Kevin Ross
  *         kevin.ross@bredex.com
  *
  * @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);
     }
 
diff --git a/src/main/org/apache/tools/ant/taskdefs/Ant.java b/src/main/org/apache/tools/ant/taskdefs/Ant.java
index 8ebe41f41..96220c924 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Ant.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Ant.java
@@ -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;
     }
 
diff --git a/src/main/org/apache/tools/ant/taskdefs/Basename.java b/src/main/org/apache/tools/ant/taskdefs/Basename.java
index 9838586c4..0d7d13c1d 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Basename.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Basename.java
@@ -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--;
           }
diff --git a/src/main/org/apache/tools/ant/taskdefs/CallTarget.java b/src/main/org/apache/tools/ant/taskdefs/CallTarget.java
index 0bd56844c..d4becee7a 100644
--- a/src/main/org/apache/tools/ant/taskdefs/CallTarget.java
+++ b/src/main/org/apache/tools/ant/taskdefs/CallTarget.java
@@ -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.
      *
diff --git a/src/main/org/apache/tools/ant/taskdefs/Concat.java b/src/main/org/apache/tools/ant/taskdefs/Concat.java
index 9ae68b114..d29df1527 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Concat.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Concat.java
@@ -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 false.
      */
@@ -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;
         }
diff --git a/src/main/org/apache/tools/ant/taskdefs/Copy.java b/src/main/org/apache/tools/ant/taskdefs/Copy.java
index d9c5897b7..dd7ffb9d8 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Copy.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Copy.java
@@ -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(
diff --git a/src/main/org/apache/tools/ant/taskdefs/Copydir.java b/src/main/org/apache/tools/ant/taskdefs/Copydir.java
index e0e05cccd..016f96985 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Copydir.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Copydir.java
@@ -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());
                     }
diff --git a/src/main/org/apache/tools/ant/taskdefs/Copyfile.java b/src/main/org/apache/tools/ant/taskdefs/Copyfile.java
index 1f747e96b..95d42cfda 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Copyfile.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Copyfile.java
@@ -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);
diff --git a/src/main/org/apache/tools/ant/taskdefs/Cvs.java b/src/main/org/apache/tools/ant/taskdefs/Cvs.java
index 9f3bd9e75..451164061 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Cvs.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Cvs.java
@@ -65,13 +65,13 @@ package org.apache.tools.ant.taskdefs;
  *
  * @author costin@dnt.ro
  * @author stefano@apache.org
- * @author Wolfgang Werner 
+ * @author Wolfgang Werner
  *         wwerner@picturesafe.de
- * @author Kevin Ross 
+ * @author Kevin Ross
  *         kevin.ross@bredex.com
  *
  * @since Ant 1.1
- * 
+ *
  * @ant.task category="scm"
  */
 public class Cvs extends AbstractCvsTask {
diff --git a/src/main/org/apache/tools/ant/taskdefs/Delete.java b/src/main/org/apache/tools/ant/taskdefs/Delete.java
index 93c373842..3b7b9e535 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Delete.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Delete.java
@@ -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.
  * 

Currently Delete extends MatchingTask. This is intend only * to provide backwards compatibility for a release. The future position * is to use nested filesets exclusively.

- * - * @author Stefano Mazzocchi + * + * @author Stefano Mazzocchi * stefano@apache.org * @author Tom Dimock tad1@cornell.edu - * @author Glenn McAllister + * @author Glenn McAllister * glennm@ca.ibm.com * @author Jon S. Stevens jon@latchkey.com * @@ -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); diff --git a/src/main/org/apache/tools/ant/taskdefs/Deltree.java b/src/main/org/apache/tools/ant/taskdefs/Deltree.java index fa24b4df4..d5941f8b4 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Deltree.java +++ b/src/main/org/apache/tools/ant/taskdefs/Deltree.java @@ -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()); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Ear.java b/src/main/org/apache/tools/ant/taskdefs/Ear.java index 00c2116a6..0d2d557c6 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Ear.java +++ b/src/main/org/apache/tools/ant/taskdefs/Ear.java @@ -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 // element. if (vPath.equalsIgnoreCase("META-INF/application.xml")) { - if (deploymentDescriptor == null + if (deploymentDescriptor == null || !fu.fileNameEquals(deploymentDescriptor, file) || descriptorAdded) { log("Warning: selected " + archiveType diff --git a/src/main/org/apache/tools/ant/taskdefs/Echo.java b/src/main/org/apache/tools/ant/taskdefs/Echo.java index 4fc062763..4178cb9f6 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Echo.java +++ b/src/main/org/apache/tools/ant/taskdefs/Echo.java @@ -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"}; } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Exec.java b/src/main/org/apache/tools/ant/taskdefs/Exec.java index c14d5459e..12f353d3a 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Exec.java +++ b/src/main/org/apache/tools/ant/taskdefs/Exec.java @@ -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); } diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecTask.java b/src/main/org/apache/tools/ant/taskdefs/ExecTask.java index 07d9ac27a..a7731b79e 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ExecTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/ExecTask.java @@ -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); diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java b/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java index f788a04bd..d6945e282 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java +++ b/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java @@ -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 Mariusz Nowostawski * * @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" + " not .", 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 { /** diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java b/src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java index a8c7b7d9f..d429db830 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java +++ b/src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java @@ -70,7 +70,7 @@ import org.apache.tools.ant.util.Watchdog; * // it was killed on purpose by the watchdog * } *
- + * @author thomas.haas@softwired-inc.com * @author Stephane Bailliez * @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 true if the process is still running, otherwise + * @return true if the process is still running, otherwise * false. */ 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 true if the process was killed otherwise + * @return true if the process was killed otherwise * false. */ public boolean killedProcess(){ diff --git a/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java b/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java index 4a7b25ad4..ca5d42ab7 100644 --- a/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java +++ b/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java @@ -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"}; } } diff --git a/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java b/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java index 364906c77..a8d7cc5c6 100644 --- a/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java +++ b/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java @@ -62,7 +62,7 @@ import org.apache.tools.ant.util.JavaEnvUtils; /** * Generates a key in a keystore. - * + * * @author Peter Donald * * @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(); - } + } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Get.java b/src/main/org/apache/tools/ant/taskdefs/Get.java index cbd6bc29b..6c53c94aa 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Get.java +++ b/src/main/org/apache/tools/ant/taskdefs/Get.java @@ -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()}); diff --git a/src/main/org/apache/tools/ant/taskdefs/ImportTask.java b/src/main/org/apache/tools/ant/taskdefs/ImportTask.java index c411d43dd..e1a2a76e8 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ImportTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/ImportTask.java @@ -67,7 +67,7 @@ import java.util.Vector; * Task to import another build file into the current project. *

* It must be 'top level'. On execution it will read another Ant file - * into the same Project. + * into the same Project. *

* Important: 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; * Important: 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 *

@@ -109,7 +109,7 @@ public class ImportTask extends Task {
         // for relative paths.
         this.file=file;
     }
-    
+
     /**
      *  This relies on the task order model.
      *
diff --git a/src/main/org/apache/tools/ant/taskdefs/Input.java b/src/main/org/apache/tools/ant/taskdefs/Input.java
index be7d7643c..9837af7f4 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Input.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Input.java
@@ -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;
         }
diff --git a/src/main/org/apache/tools/ant/taskdefs/Jar.java b/src/main/org/apache/tools/ant/taskdefs/Jar.java
index 1cd9aeb91..30bc80eec 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Jar.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Jar.java
@@ -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()));
 
diff --git a/src/main/org/apache/tools/ant/taskdefs/Java.java b/src/main/org/apache/tools/ant/taskdefs/Java.java
index 9092f57df..3a0219690 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Java.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Java.java
@@ -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
  *         stefano@apache.org
  * @author Stefan Bodewig
  * @author Donal Quinlan
@@ -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;
diff --git a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
index d5ba8051e..84556482f 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
@@ -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");
                 }
diff --git a/src/main/org/apache/tools/ant/taskdefs/Jikes.java b/src/main/org/apache/tools/ant/taskdefs/Jikes.java
index 666bf9a42..42b583d0d 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Jikes.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Jikes.java
@@ -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()
diff --git a/src/main/org/apache/tools/ant/taskdefs/JikesOutputParser.java b/src/main/org/apache/tools/ant/taskdefs/JikesOutputParser.java
index fad2292e5..d0ac301e9 100644
--- a/src/main/org/apache/tools/ant/taskdefs/JikesOutputParser.java
+++ b/src/main/org/apache/tools/ant/taskdefs/JikesOutputParser.java
@@ -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
diff --git a/src/main/org/apache/tools/ant/taskdefs/KeySubst.java b/src/main/org/apache/tools/ant/taskdefs/KeySubst.java
index f9cc4755c..1ea3f58b8 100644
--- a/src/main/org/apache/tools/ant/taskdefs/KeySubst.java
+++ b/src/main/org/apache/tools/ant/taskdefs/KeySubst.java
@@ -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 jon@clearink.com
@@ -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:
         

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)) { diff --git a/src/main/org/apache/tools/ant/taskdefs/LoadFile.java b/src/main/org/apache/tools/ant/taskdefs/LoadFile.java index ceb3d0031..418aab514 100644 --- a/src/main/org/apache/tools/ant/taskdefs/LoadFile.java +++ b/src/main/org/apache/tools/ant/taskdefs/LoadFile.java @@ -189,7 +189,7 @@ public final class LoadFile extends Task { crh.setFilterChains(filterChains); crh.setProject(getProject()); instream = crh.getAssembledReader(); - + text = crh.readFully(instream); } diff --git a/src/main/org/apache/tools/ant/taskdefs/LogOutputStream.java b/src/main/org/apache/tools/ant/taskdefs/LogOutputStream.java index 20a68ba24..ccc7019c9 100644 --- a/src/main/org/apache/tools/ant/taskdefs/LogOutputStream.java +++ b/src/main/org/apache/tools/ant/taskdefs/LogOutputStream.java @@ -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 processLine diff --git a/src/main/org/apache/tools/ant/taskdefs/Manifest.java b/src/main/org/apache/tools/ant/taskdefs/Manifest.java index 8463bbd60..6f9dcc3ea 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Manifest.java +++ b/src/main/org/apache/tools/ant/taskdefs/Manifest.java @@ -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); diff --git a/src/main/org/apache/tools/ant/taskdefs/ManifestTask.java b/src/main/org/apache/tools/ant/taskdefs/ManifestTask.java index 4355e38e1..277165901 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ManifestTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/ManifestTask.java @@ -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. */ diff --git a/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java b/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java index a52d6a5ef..f7956cc65 100644 --- a/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java @@ -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 */ diff --git a/src/main/org/apache/tools/ant/taskdefs/Mkdir.java b/src/main/org/apache/tools/ant/taskdefs/Mkdir.java index 460e761ca..95c958d59 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Mkdir.java +++ b/src/main/org/apache/tools/ant/taskdefs/Mkdir.java @@ -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()); } diff --git a/src/main/org/apache/tools/ant/taskdefs/Parallel.java b/src/main/org/apache/tools/ant/taskdefs/Parallel.java index fd4177d78..8830e9c5e 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Parallel.java +++ b/src/main/org/apache/tools/ant/taskdefs/Parallel.java @@ -66,14 +66,14 @@ import org.apache.tools.ant.util.StringUtils; * Executes the contained tasks in separate threads, continuing * once all are completed. *

- * 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 waitFor task when specifying threadCount - * 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). *

* @author Thomas Christen chr@active.ch @@ -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 - * java.lang.Runtime.availableProcessors()). 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 + * java.lang.Runtime.availableProcessors()). 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 * threadCount.; 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 threadCount - * tasks will be executed at one time. If threadsPerProcessor - * 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 threadCount + * tasks will be executed at one time. If threadsPerProcessor + * 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; } } - + } diff --git a/src/main/org/apache/tools/ant/taskdefs/Patch.java b/src/main/org/apache/tools/ant/taskdefs/Patch.java index f887e427b..35a5e782e 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Patch.java +++ b/src/main/org/apache/tools/ant/taskdefs/Patch.java @@ -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()); diff --git a/src/main/org/apache/tools/ant/taskdefs/PathConvert.java b/src/main/org/apache/tools/ant/taskdefs/PathConvert.java index 86a4c50c5..c971490d2 100644 --- a/src/main/org/apache/tools/ant/taskdefs/PathConvert.java +++ b/src/main/org/apache/tools/ant/taskdefs/PathConvert.java @@ -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 diff --git a/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java b/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java index fd28dfafe..eb2121b82 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java +++ b/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java @@ -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 ProcessDestroyer and obtains - * Runtime.addShutdownHook() and - * Runtime.removeShutdownHook() 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 ProcessDestroyer is registered as a shutdown hook. If + * Constructs a ProcessDestroyer and obtains + * Runtime.addShutdownHook() and + * Runtime.removeShutdownHook() 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 ProcessDestroyer is registered as a shutdown hook. If * removing a process results in an empty list, the * ProcessDestroyer 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 ProcessDestroyer as a shutdown hook, + * Registers this ProcessDestroyer as a shutdown hook, * uses reflection to ensure pre-JDK 1.3 compatibility. */ private void addShutdownHook(){ @@ -140,7 +140,7 @@ class ProcessDestroyer } } } - + /** * Registers this ProcessDestroyer 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 true if the specified Process was * successfully added to the list of processes to destroy upon VM exit. - * + * * @param process the process to add * @return true if the specified Process 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(); } diff --git a/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java b/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java index 227a97baa..dc91fbcbf 100644 --- a/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java +++ b/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java @@ -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; diff --git a/src/main/org/apache/tools/ant/taskdefs/Replace.java b/src/main/org/apache/tools/ant/taskdefs/Replace.java index e4f070415..f2b047515 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Replace.java +++ b/src/main/org/apache/tools/ant/taskdefs/Replace.java @@ -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 <replacetoken> element. - * @author Stefano Mazzocchi + * @author Stefano Mazzocchi * stefano@apache.org * @author Erik Langenbach * @@ -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(); diff --git a/src/main/org/apache/tools/ant/taskdefs/SQLExec.java b/src/main/org/apache/tools/ant/taskdefs/SQLExec.java index 3ad40de57..a981e4bb2 100644 --- a/src/main/org/apache/tools/ant/taskdefs/SQLExec.java +++ b/src/main/org/apache/tools/ant/taskdefs/SQLExec.java @@ -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. * *

Statements can - * either be read in from a text file using the src attribute or from + * either be read in from a text file using the src attribute or from * between the enclosing SQL tags.

- * - *

Multiple statements can be provided, separated by semicolons (or the - * defined delimiter). Individual lines within the statements can be + * + *

Multiple statements can be provided, separated by semicolons (or the + * defined delimiter). Individual lines within the statements can be * commented using either --, // or REM at the start of the line.

- * - *

The autocommit 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 + * + *

The autocommit 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.

- * - *

The onerror attribute specifies how to proceed when an error occurs - * during the execution of one of the statements. + * + *

The onerror attribute specifies how to proceed when an error occurs + * during the execution of one of the statements. * The possible values are: continue execution, only show the error; * stop execution and commit transaction; * and abort execution and transaction and fail task.

- * + * * @author Jeff Martin * @author Michael McCallum * @author Tim Stephenson @@ -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 ";"; + * Set the delimiter that separates SQL statements. Defaults to ";"; * optional * *

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 "abort" @@ -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); diff --git a/src/main/org/apache/tools/ant/taskdefs/SendEmail.java b/src/main/org/apache/tools/ant/taskdefs/SendEmail.java index d8a08dc58..7750ecc3a 100644 --- a/src/main/org/apache/tools/ant/taskdefs/SendEmail.java +++ b/src/main/org/apache/tools/ant/taskdefs/SendEmail.java @@ -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 * diff --git a/src/main/org/apache/tools/ant/taskdefs/Sequential.java b/src/main/org/apache/tools/ant/taskdefs/Sequential.java index 8c181c6ed..db8d3fe26 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Sequential.java +++ b/src/main/org/apache/tools/ant/taskdefs/Sequential.java @@ -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} *

- * 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.

- + * @author Thomas Christen chr@active.ch * @since Ant 1.4 * @ant.task category="control" diff --git a/src/main/org/apache/tools/ant/taskdefs/SignJar.java b/src/main/org/apache/tools/ant/taskdefs/SignJar.java index 9ff1ddef4..435f29b3b 100644 --- a/src/main/org/apache/tools/ant/taskdefs/SignJar.java +++ b/src/main/org/apache/tools/ant/taskdefs/SignJar.java @@ -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 { diff --git a/src/main/org/apache/tools/ant/taskdefs/StreamPumper.java b/src/main/org/apache/tools/ant/taskdefs/StreamPumper.java index ca9558c84..d1edf886d 100644 --- a/src/main/org/apache/tools/ant/taskdefs/StreamPumper.java +++ b/src/main/org/apache/tools/ant/taskdefs/StreamPumper.java @@ -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. * diff --git a/src/main/org/apache/tools/ant/taskdefs/Sync.java b/src/main/org/apache/tools/ant/taskdefs/Sync.java index df964a43a..2ae613284 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Sync.java +++ b/src/main/org/apache/tools/ant/taskdefs/Sync.java @@ -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); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Tar.java b/src/main/org/apache/tools/ant/taskdefs/Tar.java index 89dd8e753..bd8bcaa36 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Tar.java +++ b/src/main/org/apache/tools/ant/taskdefs/Tar.java @@ -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 */ diff --git a/src/main/org/apache/tools/ant/taskdefs/Touch.java b/src/main/org/apache/tools/ant/taskdefs/Touch.java index c5e47a3bd..b7b73aefa 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Touch.java +++ b/src/main/org/apache/tools/ant/taskdefs/Touch.java @@ -77,7 +77,7 @@ import org.apache.tools.ant.util.JavaEnvUtils; *

Note: Setting the modification time of files is not supported in * JDK 1.1.

* - * @author Stefan Bodewig + * @author Stefan Bodewig * @author Michael J. Sikorsky * @author Robert Shaw * @@ -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 "MM/DD/YYYY HH:MM AM or PM" + * in the format "MM/DD/YYYY HH:MM AM or PM" * or "MM/DD/YYYY HH:MM:SS AM or PM". * 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])); } diff --git a/src/main/org/apache/tools/ant/taskdefs/Transform.java b/src/main/org/apache/tools/ant/taskdefs/Transform.java index 8edb51e00..5235e8c56 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Transform.java +++ b/src/main/org/apache/tools/ant/taskdefs/Transform.java @@ -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 diff --git a/src/main/org/apache/tools/ant/taskdefs/Typedef.java b/src/main/org/apache/tools/ant/taskdefs/Typedef.java index 8339157b0..9a5e25f89 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Typedef.java +++ b/src/main/org/apache/tools/ant/taskdefs/Typedef.java @@ -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.

*

Custom data types usually need custom tasks to put them to good use.

- * + * * @author Stefan Bodewig * @since Ant 1.4 * @ant.task category="internal" diff --git a/src/main/org/apache/tools/ant/taskdefs/Untar.java b/src/main/org/apache/tools/ant/taskdefs/Untar.java index a2642b69b..b1647f7b0 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Untar.java +++ b/src/main/org/apache/tools/ant/taskdefs/Untar.java @@ -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()); } diff --git a/src/main/org/apache/tools/ant/taskdefs/UpToDate.java b/src/main/org/apache/tools/ant/taskdefs/UpToDate.java index b74fec08a..b47cf81e8 100644 --- a/src/main/org/apache/tools/ant/taskdefs/UpToDate.java +++ b/src/main/org/apache/tools/ant/taskdefs/UpToDate.java @@ -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 - * williamf@mincom.com - * @author Hiroaki Nakamura + * @author William Ferguson + * williamf@mincom.com + * @author Hiroaki Nakamura * hnakamur@mc.neweb.ne.jp * @author Stefan Bodewig * @author Eli Tucker @@ -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.", diff --git a/src/main/org/apache/tools/ant/taskdefs/WaitFor.java b/src/main/org/apache/tools/ant/taskdefs/WaitFor.java index 19b5f0f6d..55f5b9419 100644 --- a/src/main/org/apache/tools/ant/taskdefs/WaitFor.java +++ b/src/main/org/apache/tools/ant/taskdefs/WaitFor.java @@ -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 */ diff --git a/src/main/org/apache/tools/ant/taskdefs/War.java b/src/main/org/apache/tools/ant/taskdefs/War.java index d5ac21bb9..4223c727a 100644 --- a/src/main/org/apache/tools/ant/taskdefs/War.java +++ b/src/main/org/apache/tools/ant/taskdefs/War.java @@ -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 diff --git a/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java b/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java index 56814814b..9df8446b9 100644 --- a/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java +++ b/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java @@ -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; diff --git a/src/main/org/apache/tools/ant/taskdefs/XmlProperty.java b/src/main/org/apache/tools/ant/taskdefs/XmlProperty.java index eca4db3e9..69b9bef8d 100644 --- a/src/main/org/apache/tools/ant/taskdefs/XmlProperty.java +++ b/src/main/org/apache/tools/ant/taskdefs/XmlProperty.java @@ -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 { diff --git a/src/main/org/apache/tools/ant/taskdefs/Zip.java b/src/main/org/apache/tools/ant/taskdefs/Zip.java index 359550fc7..b0cd2e3a9 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Zip.java +++ b/src/main/org/apache/tools/ant/taskdefs/Zip.java @@ -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. * - *

Included directories will preceede included files.

+ *

Included directories will preceede included files.

* * @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); } }