git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274776 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -155,8 +155,8 @@ public class AntClassLoader extends ClassLoader implements BuildListener { | |||||
| */ | */ | ||||
| private void findNextResource() { | private void findNextResource() { | ||||
| URL url = null; | URL url = null; | ||||
| while ((pathElementsIndex < pathComponents.size()) && | |||||
| (url == null)) { | |||||
| while ((pathElementsIndex < pathComponents.size()) | |||||
| && (url == null)) { | |||||
| try { | try { | ||||
| File pathComponent | File pathComponent | ||||
| = (File) pathComponents.elementAt(pathElementsIndex); | = (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() { | public AntClassLoader() { | ||||
| setParent(null); | 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 | * @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 | * 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 | * @param classpath the serahc classpath consisting of directories and | ||||
| * jar/zip files. | * 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 | * 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 | * false violates the class loader hierarchy and can lead to Linkage errors | ||||
| * | * | ||||
| * @param parentFirst if true, delegate initial class search to the parent | * @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); | throw new BuildException(e); | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Add a file to the path | * 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. | * @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); | pathComponents.addElement(pathComponent); | ||||
| } | } | ||||
| @@ -986,11 +986,11 @@ public class AntClassLoader extends ClassLoader implements BuildListener { | |||||
| if (isParentFirst(classname)) { | if (isParentFirst(classname)) { | ||||
| try { | try { | ||||
| theClass = findBaseClass(classname); | theClass = findBaseClass(classname); | ||||
| log("Class " + classname + " loaded from parent loader " | |||||
| log("Class " + classname + " loaded from parent loader " | |||||
| + "(parentFirst)", Project.MSG_DEBUG); | + "(parentFirst)", Project.MSG_DEBUG); | ||||
| } catch (ClassNotFoundException cnfe) { | } catch (ClassNotFoundException cnfe) { | ||||
| theClass = findClass(classname); | theClass = findClass(classname); | ||||
| log("Class " + classname + " loaded from ant loader " | |||||
| log("Class " + classname + " loaded from ant loader " | |||||
| + "(parentFirst)", Project.MSG_DEBUG); | + "(parentFirst)", Project.MSG_DEBUG); | ||||
| } | } | ||||
| } else { | } else { | ||||
| @@ -1073,7 +1073,7 @@ public class AntClassLoader extends ClassLoader implements BuildListener { | |||||
| return defineClass(classname, classData, 0, classData.length); | return defineClass(classname, classData, 0, classData.length); | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Reads a class definition from a stream. | * Reads a class definition from a stream. | ||||
| * | * | ||||
| @@ -1122,7 +1122,7 @@ public class AntClassLoader extends ClassLoader implements BuildListener { | |||||
| return findClassInComponents(name); | return findClassInComponents(name); | ||||
| } | } | ||||
| /** | |||||
| /** | |||||
| * Indicate if the given file is in this loader's path | * Indicate if the given file is in this loader's path | ||||
| * | * | ||||
| * @param component the file which is to be checked | * @param component the file which is to be checked | ||||
| @@ -1138,7 +1138,7 @@ public class AntClassLoader extends ClassLoader implements BuildListener { | |||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| /** | /** | ||||
| * Finds a class on the given classpath. | * Finds a class on the given classpath. | ||||
| @@ -1164,7 +1164,7 @@ public class AntClassLoader extends ClassLoader implements BuildListener { | |||||
| try { | try { | ||||
| stream = getResourceStream(pathComponent, classFilename); | stream = getResourceStream(pathComponent, classFilename); | ||||
| if (stream != null) { | if (stream != null) { | ||||
| log("Loaded from " + pathComponent + " " | |||||
| log("Loaded from " + pathComponent + " " | |||||
| + classFilename, Project.MSG_DEBUG); | + classFilename, Project.MSG_DEBUG); | ||||
| return getClassFromStream(stream, name, pathComponent); | return getClassFromStream(stream, name, pathComponent); | ||||
| } | } | ||||
| @@ -1184,7 +1184,9 @@ public class AntClassLoader extends ClassLoader implements BuildListener { | |||||
| if (stream != null) { | if (stream != null) { | ||||
| stream.close(); | stream.close(); | ||||
| } | } | ||||
| } catch (IOException e) {} | |||||
| } catch (IOException e) { | |||||
| //ignore | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -65,14 +65,14 @@ import java.util.EventObject; | |||||
| * @author Matt Foemmel | * @author Matt Foemmel | ||||
| */ | */ | ||||
| public class BuildEvent extends EventObject { | public class BuildEvent extends EventObject { | ||||
| /** Project which emitted the event. */ | /** Project which emitted the event. */ | ||||
| private Project project; | private Project project; | ||||
| /** Target which emitted the event, if specified. */ | /** Target which emitted the event, if specified. */ | ||||
| private Target target; | private Target target; | ||||
| /** Task which emitted the event, if specified. */ | /** Task which emitted the event, if specified. */ | ||||
| private Task task; | private Task task; | ||||
| /** | |||||
| /** | |||||
| * Message associated with the event. This is only used for | * Message associated with the event. This is only used for | ||||
| * "messageLogged" events. | * "messageLogged" events. | ||||
| */ | */ | ||||
| @@ -83,7 +83,7 @@ public class BuildEvent extends EventObject { | |||||
| private int priority = Project.MSG_VERBOSE; | private int priority = Project.MSG_VERBOSE; | ||||
| /** | /** | ||||
| * The exception associated with this event, if any. | * 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. | * and "buildFinished" events. | ||||
| */ | */ | ||||
| private Throwable exception; | private Throwable exception; | ||||
| @@ -100,7 +100,7 @@ public class BuildEvent extends EventObject { | |||||
| this.target = null; | this.target = null; | ||||
| this.task = null; | this.task = null; | ||||
| } | } | ||||
| /** | /** | ||||
| * Construct a BuildEvent for a target level event. | * Construct a BuildEvent for a target level event. | ||||
| * The project associated with the event is derived | * The project associated with the event is derived | ||||
| @@ -115,10 +115,10 @@ public class BuildEvent extends EventObject { | |||||
| this.target = target; | this.target = target; | ||||
| this.task = null; | this.task = null; | ||||
| } | } | ||||
| /** | /** | ||||
| * Construct a BuildEvent for a task level event. | * 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. | * are derived from the given task. | ||||
| * | * | ||||
| * @param task the task that emitted the event. | * @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. | * Sets the message and priority associated with this event. | ||||
| * This is used for "messageLogged" events. | * This is used for "messageLogged" events. | ||||
| * | |||||
| * | |||||
| * @param message the message to be associated with this event. | * @param message the message to be associated with this event. | ||||
| * Should not be <code>null</code>. | * Should not be <code>null</code>. | ||||
| * @param priority the priority to be associated with this event, | * @param priority the priority to be associated with this event, | ||||
| @@ -146,12 +146,12 @@ public class BuildEvent extends EventObject { | |||||
| this.message = message; | this.message = message; | ||||
| this.priority = priority; | 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. | * events. | ||||
| * | |||||
| * | |||||
| * @param exception The exception to be associated with this event. | * @param exception The exception to be associated with this event. | ||||
| * May be <code>null</code>. | * May be <code>null</code>. | ||||
| * | * | ||||
| @@ -165,7 +165,7 @@ public class BuildEvent extends EventObject { | |||||
| /** | /** | ||||
| * Returns the project that fired this event. | * Returns the project that fired this event. | ||||
| * | |||||
| * | |||||
| * @return the project that fired this event | * @return the project that fired this event | ||||
| */ | */ | ||||
| public Project getProject() { | public Project getProject() { | ||||
| @@ -174,18 +174,18 @@ public class BuildEvent extends EventObject { | |||||
| /** | /** | ||||
| * Returns the target that fired this event. | * Returns the target that fired this event. | ||||
| * | |||||
| * | |||||
| * @return the project that fired this event, or <code>null</code> | * @return the project that fired this event, or <code>null</code> | ||||
| * if this event is a project level event. | * if this event is a project level event. | ||||
| */ | */ | ||||
| public Target getTarget() { | public Target getTarget() { | ||||
| return target; | return target; | ||||
| } | } | ||||
| /** | /** | ||||
| * Returns the task that fired this event. | * Returns the task that fired this event. | ||||
| * | |||||
| * | |||||
| * @return the task that fired this event, or <code>null</code> | * @return the task that fired this event, or <code>null</code> | ||||
| * if this event is a project or target level event. | * if this event is a project or target level event. | ||||
| */ | */ | ||||
| @@ -199,7 +199,7 @@ public class BuildEvent extends EventObject { | |||||
| * | * | ||||
| * @return the message associated with this event, or <code>null</code> | * @return the message associated with this event, or <code>null</code> | ||||
| * if no message has been set. | * if no message has been set. | ||||
| * | |||||
| * | |||||
| * @see BuildListener#messageLogged(BuildEvent) | * @see BuildListener#messageLogged(BuildEvent) | ||||
| */ | */ | ||||
| public String getMessage() { | public String getMessage() { | ||||
| @@ -210,12 +210,12 @@ public class BuildEvent extends EventObject { | |||||
| * Returns the priority of the logging message. This field will only | * Returns the priority of the logging message. This field will only | ||||
| * be set for "messageLogged" events. The meaning of this priority | * be set for "messageLogged" events. The meaning of this priority | ||||
| * is as specified by the constants in the {@link Project Project} class. | * is as specified by the constants in the {@link Project Project} class. | ||||
| * | |||||
| * | |||||
| * @return the priority associated with this event. | * @return the priority associated with this event. | ||||
| * | * | ||||
| * @see BuildListener#messageLogged(BuildEvent) | * @see BuildListener#messageLogged(BuildEvent) | ||||
| */ | */ | ||||
| public int getPriority(){ | |||||
| public int getPriority() { | |||||
| return priority; | return priority; | ||||
| } | } | ||||
| @@ -223,8 +223,8 @@ public class BuildEvent extends EventObject { | |||||
| * Returns the exception that was thrown, if any. This field will only | * Returns the exception that was thrown, if any. This field will only | ||||
| * be set for "taskFinished", "targetFinished", and "buildFinished" | * be set for "taskFinished", "targetFinished", and "buildFinished" | ||||
| * events. | * events. | ||||
| * | |||||
| * @return the exception associated with this exception, or | |||||
| * | |||||
| * @return the exception associated with this exception, or | |||||
| * <code>null</code> if no exception has been set. | * <code>null</code> if no exception has been set. | ||||
| * | * | ||||
| * @see BuildListener#taskFinished(BuildEvent) | * @see BuildListener#taskFinished(BuildEvent) | ||||
| @@ -57,7 +57,7 @@ package org.apache.tools.ant; | |||||
| import java.util.EventListener; | 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. | * to be notified when things happened during a build. | ||||
| * | * | ||||
| * @see BuildEvent | * @see BuildEvent | ||||
| @@ -70,7 +70,7 @@ public interface BuildListener extends EventListener { | |||||
| /** | /** | ||||
| * Signals that a build has started. This event | * Signals that a build has started. This event | ||||
| * is fired before any targets have started. | * is fired before any targets have started. | ||||
| * | |||||
| * | |||||
| * @param event An event with any relevant extra information. | * @param event An event with any relevant extra information. | ||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| */ | */ | ||||
| @@ -79,7 +79,7 @@ public interface BuildListener extends EventListener { | |||||
| /** | /** | ||||
| * Signals that the last target has finished. This event | * Signals that the last target has finished. This event | ||||
| * will still be fired if an error occurred during the build. | * will still be fired if an error occurred during the build. | ||||
| * | |||||
| * | |||||
| * @param event An event with any relevant extra information. | * @param event An event with any relevant extra information. | ||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| * | * | ||||
| @@ -89,7 +89,7 @@ public interface BuildListener extends EventListener { | |||||
| /** | /** | ||||
| * Signals that a target is starting. | * Signals that a target is starting. | ||||
| * | |||||
| * | |||||
| * @param event An event with any relevant extra information. | * @param event An event with any relevant extra information. | ||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| * | * | ||||
| @@ -100,7 +100,7 @@ public interface BuildListener extends EventListener { | |||||
| /** | /** | ||||
| * Signals that a target has finished. This event will | * Signals that a target has finished. This event will | ||||
| * still be fired if an error occurred during the build. | * still be fired if an error occurred during the build. | ||||
| * | |||||
| * | |||||
| * @param event An event with any relevant extra information. | * @param event An event with any relevant extra information. | ||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| * | * | ||||
| @@ -110,7 +110,7 @@ public interface BuildListener extends EventListener { | |||||
| /** | /** | ||||
| * Signals that a task is starting. | * Signals that a task is starting. | ||||
| * | |||||
| * | |||||
| * @param event An event with any relevant extra information. | * @param event An event with any relevant extra information. | ||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| * | * | ||||
| @@ -131,7 +131,7 @@ public interface BuildListener extends EventListener { | |||||
| /** | /** | ||||
| * Signals a message logging event. | * Signals a message logging event. | ||||
| * | |||||
| * | |||||
| * @param event An event with any relevant extra information. | * @param event An event with any relevant extra information. | ||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| * | * | ||||
| @@ -57,32 +57,32 @@ package org.apache.tools.ant; | |||||
| import java.io.PrintStream; | import java.io.PrintStream; | ||||
| /** | /** | ||||
| * Interface used by Ant to log the build output. | |||||
| * Interface used by Ant to log the build output. | |||||
| * | * | ||||
| * A build logger is a build listener which has the 'right' to send output to | |||||
| * the ant log, which is usually <code>System.out</code> unless redirected by | |||||
| * A build logger is a build listener which has the 'right' to send output to | |||||
| * the ant log, which is usually <code>System.out</code> unless redirected by | |||||
| * the <code>-logfile</code> option. | * the <code>-logfile</code> option. | ||||
| * | * | ||||
| * @author Conor MacNeill | * @author Conor MacNeill | ||||
| */ | */ | ||||
| public interface BuildLogger extends BuildListener { | public interface BuildLogger extends BuildListener { | ||||
| /** | /** | ||||
| * Sets the highest level of message this logger should respond to. | * 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. | * given level should be written to the log. | ||||
| * <P> | * <P> | ||||
| * Constants for the message levels are in the | |||||
| * {@link Project Project} class. The order of the levels, from least | |||||
| * to most verbose, is <code>MSG_ERR</code>, <code>MSG_WARN</code>, | |||||
| * <code>MSG_INFO</code>, <code>MSG_VERBOSE</code>, | |||||
| * Constants for the message levels are in the | |||||
| * {@link Project Project} class. The order of the levels, from least | |||||
| * to most verbose, is <code>MSG_ERR</code>, <code>MSG_WARN</code>, | |||||
| * <code>MSG_INFO</code>, <code>MSG_VERBOSE</code>, | |||||
| * <code>MSG_DEBUG</code>. | * <code>MSG_DEBUG</code>. | ||||
| * | * | ||||
| * @param level the logging level for the logger. | * @param level the logging level for the logger. | ||||
| */ | */ | ||||
| void setMessageOutputLevel(int level); | void setMessageOutputLevel(int level); | ||||
| /** | /** | ||||
| * Sets the output stream to which this logger is to send its output. | * Sets the output stream to which this logger is to send its output. | ||||
| * | * | ||||
| @@ -90,7 +90,7 @@ public interface BuildLogger extends BuildListener { | |||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| */ | */ | ||||
| void setOutputPrintStream(PrintStream output); | void setOutputPrintStream(PrintStream output); | ||||
| /** | /** | ||||
| * Sets this logger to produce emacs (and other editor) friendly 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. | * @param err The error stream for the logger. | ||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| */ | */ | ||||
| void setErrorPrintStream(PrintStream err); | |||||
| void setErrorPrintStream(PrintStream err); | |||||
| } | } | ||||
| @@ -105,8 +105,8 @@ public class ComponentHelper { | |||||
| */ | */ | ||||
| private Hashtable createdTasks = new Hashtable(); | 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 | * find a project component for a specific project, creating | ||||
| @@ -69,7 +69,7 @@ import org.apache.tools.ant.util.StringUtils; | |||||
| * @author Matt Foemmel | * @author Matt Foemmel | ||||
| */ | */ | ||||
| public class DefaultLogger implements BuildLogger { | public class DefaultLogger implements BuildLogger { | ||||
| /** | |||||
| /** | |||||
| * Size of left-hand column for right-justified task name. | * Size of left-hand column for right-justified task name. | ||||
| * @see #messageLogged(BuildEvent) | * @see #messageLogged(BuildEvent) | ||||
| */ | */ | ||||
| @@ -77,16 +77,19 @@ public class DefaultLogger implements BuildLogger { | |||||
| /** PrintStream to write non-error messages to */ | /** PrintStream to write non-error messages to */ | ||||
| protected PrintStream out; | protected PrintStream out; | ||||
| /** PrintStream to write error messages to */ | /** PrintStream to write error messages to */ | ||||
| protected PrintStream err; | protected PrintStream err; | ||||
| /** Lowest level of message to write out */ | /** Lowest level of message to write out */ | ||||
| protected int msgOutputLevel = Project.MSG_ERR; | protected int msgOutputLevel = Project.MSG_ERR; | ||||
| /** Time of the start of the build */ | /** Time of the start of the build */ | ||||
| private long startTime = System.currentTimeMillis(); | private long startTime = System.currentTimeMillis(); | ||||
| /** Line separator */ | /** Line separator */ | ||||
| protected static final String lSep = StringUtils.LINE_SEP; | protected static final String lSep = StringUtils.LINE_SEP; | ||||
| /** Whether or not to use emacs-style output */ | /** Whether or not to use emacs-style output */ | ||||
| protected boolean emacsMode = false; | protected boolean emacsMode = false; | ||||
| @@ -99,17 +102,17 @@ public class DefaultLogger implements BuildLogger { | |||||
| /** | /** | ||||
| * Sets the highest level of message this logger should respond to. | * 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. | * given level should be written to the log. | ||||
| * <P> | * <P> | ||||
| * Constants for the message levels are in the | |||||
| * {@link Project Project} class. The order of the levels, from least | |||||
| * to most verbose, is <code>MSG_ERR</code>, <code>MSG_WARN</code>, | |||||
| * <code>MSG_INFO</code>, <code>MSG_VERBOSE</code>, | |||||
| * Constants for the message levels are in the | |||||
| * {@link Project Project} class. The order of the levels, from least | |||||
| * to most verbose, is <code>MSG_ERR</code>, <code>MSG_WARN</code>, | |||||
| * <code>MSG_INFO</code>, <code>MSG_VERBOSE</code>, | |||||
| * <code>MSG_DEBUG</code>. | * <code>MSG_DEBUG</code>. | ||||
| * <P> | * <P> | ||||
| * The default message level for DefaultLogger is Project.MSG_ERR. | * The default message level for DefaultLogger is Project.MSG_ERR. | ||||
| * | |||||
| * | |||||
| * @param level the logging level for the logger. | * @param level the logging level for the logger. | ||||
| */ | */ | ||||
| public void setMessageOutputLevel(int level) { | 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. | * Responds to a build being started by just remembering the current time. | ||||
| * | |||||
| * | |||||
| * @param event Ignored. | * @param event Ignored. | ||||
| */ | */ | ||||
| public void buildStarted(BuildEvent event) { | public void buildStarted(BuildEvent event) { | ||||
| @@ -159,7 +162,7 @@ public class DefaultLogger implements BuildLogger { | |||||
| * Prints whether the build succeeded or failed, | * Prints whether the build succeeded or failed, | ||||
| * any errors the occured during the build, and | * any errors the occured during the build, and | ||||
| * how long the build took. | * how long the build took. | ||||
| * | |||||
| * | |||||
| * @param event An event with any relevant extra information. | * @param event An event with any relevant extra information. | ||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| */ | */ | ||||
| @@ -175,8 +178,8 @@ public class DefaultLogger implements BuildLogger { | |||||
| message.append("BUILD FAILED"); | message.append("BUILD FAILED"); | ||||
| message.append(StringUtils.LINE_SEP); | 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)); | message.append(StringUtils.getStackTrace(error)); | ||||
| } else { | } else { | ||||
| if (error instanceof BuildException) { | 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 | * Logs a message to say that the target has started if this | ||||
| * logger allows information-level messages. | * logger allows information-level messages. | ||||
| * | |||||
| * | |||||
| * @param event An event with any relevant extra information. | * @param event An event with any relevant extra information. | ||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| */ | */ | ||||
| public void targetStarted(BuildEvent event) { | public void targetStarted(BuildEvent event) { | ||||
| if (Project.MSG_INFO <= msgOutputLevel | if (Project.MSG_INFO <= msgOutputLevel | ||||
| && !event.getTarget().getName().equals("")) { | && !event.getTarget().getName().equals("")) { | ||||
| String msg = StringUtils.LINE_SEP | |||||
| String msg = StringUtils.LINE_SEP | |||||
| + event.getTarget().getName() + ":"; | + event.getTarget().getName() + ":"; | ||||
| printMessage(msg, out, event.getPriority()); | printMessage(msg, out, event.getPriority()); | ||||
| log(msg); | log(msg); | ||||
| @@ -218,30 +221,33 @@ public class DefaultLogger implements BuildLogger { | |||||
| /** | /** | ||||
| * No-op implementation. | * No-op implementation. | ||||
| * | |||||
| * | |||||
| * @param event Ignored. | * @param event Ignored. | ||||
| */ | */ | ||||
| public void targetFinished(BuildEvent event) {} | |||||
| public void targetFinished(BuildEvent event) { | |||||
| } | |||||
| /** | /** | ||||
| * No-op implementation. | * No-op implementation. | ||||
| * | |||||
| * | |||||
| * @param event Ignored. | * @param event Ignored. | ||||
| */ | */ | ||||
| public void taskStarted(BuildEvent event) {} | |||||
| public void taskStarted(BuildEvent event) { | |||||
| } | |||||
| /** | /** | ||||
| * No-op implementation. | * No-op implementation. | ||||
| * | |||||
| * | |||||
| * @param event Ignored. | * @param event Ignored. | ||||
| */ | */ | ||||
| public void taskFinished(BuildEvent event) {} | |||||
| public void taskFinished(BuildEvent event) { | |||||
| } | |||||
| /** | /** | ||||
| * Logs a message, if the priority is suitable. | * Logs a message, if the priority is suitable. | ||||
| * In non-emacs mode, task level messages are prefixed by the | * In non-emacs mode, task level messages are prefixed by the | ||||
| * task name which is right-justified. | * task name which is right-justified. | ||||
| * | |||||
| * | |||||
| * @param event A BuildEvent containing message information. | * @param event A BuildEvent containing message information. | ||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| */ | */ | ||||
| @@ -264,7 +270,7 @@ public class DefaultLogger implements BuildLogger { | |||||
| label = tmp.toString(); | label = tmp.toString(); | ||||
| try { | try { | ||||
| BufferedReader r = | |||||
| BufferedReader r = | |||||
| new BufferedReader( | new BufferedReader( | ||||
| new StringReader(event.getMessage())); | new StringReader(event.getMessage())); | ||||
| String line = r.readLine(); | String line = r.readLine(); | ||||
| @@ -297,9 +303,9 @@ public class DefaultLogger implements BuildLogger { | |||||
| /** | /** | ||||
| * Convenience method to format a specified length of time. | * Convenience method to format a specified length of time. | ||||
| * | |||||
| * | |||||
| * @param millis Length of time to format, in milliseonds. | * @param millis Length of time to format, in milliseonds. | ||||
| * | |||||
| * | |||||
| * @return the time as a formatted string. | * @return the time as a formatted string. | ||||
| * | * | ||||
| * @see DateUtils#formatElapsedTime(long) | * @see DateUtils#formatElapsedTime(long) | ||||
| @@ -310,12 +316,12 @@ public class DefaultLogger implements BuildLogger { | |||||
| /** | /** | ||||
| * Prints a message to a PrintStream. | * Prints a message to a PrintStream. | ||||
| * | |||||
| * @param message The message to print. | |||||
| * | |||||
| * @param message The message to print. | |||||
| * Should not be <code>null</code>. | * Should not be <code>null</code>. | ||||
| * @param stream A PrintStream to print the message to. | |||||
| * @param stream A PrintStream to print the message to. | |||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| * @param priority The priority of the message. | |||||
| * @param priority The priority of the message. | |||||
| * (Ignored in this implementation.) | * (Ignored in this implementation.) | ||||
| */ | */ | ||||
| protected void printMessage(final String message, | protected void printMessage(final String message, | ||||
| @@ -327,8 +333,9 @@ public class DefaultLogger implements BuildLogger { | |||||
| /** | /** | ||||
| * Empty implementation which allows subclasses to receive the | * Empty implementation which allows subclasses to receive the | ||||
| * same output that is generated here. | * same output that is generated here. | ||||
| * | |||||
| * | |||||
| * @param message Message being logged. Should not be <code>null</code>. | * @param message Message being logged. Should not be <code>null</code>. | ||||
| */ | */ | ||||
| protected void log(String message) {} | |||||
| protected void log(String message) { | |||||
| } | |||||
| } | } | ||||
| @@ -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. | * individual tasks and threads. | ||||
| * | * | ||||
| * @since Ant 1.6 | * @since Ant 1.6 | ||||
| @@ -71,7 +71,7 @@ public class DemuxInputStream extends InputStream { | |||||
| * The project to from which to get input. | * The project to from which to get input. | ||||
| */ | */ | ||||
| private Project project; | private Project project; | ||||
| /** | /** | ||||
| * Create a DemuxInputStream for the given project | * Create a DemuxInputStream for the given project | ||||
| * | * | ||||
| @@ -91,7 +91,7 @@ public class DemuxInputStream extends InputStream { | |||||
| } | } | ||||
| return buffer[0]; | return buffer[0]; | ||||
| } | } | ||||
| /** | /** | ||||
| * @see InputStream.read(byte[], int, int) | * @see InputStream.read(byte[], int, int) | ||||
| @@ -78,18 +78,18 @@ public class DemuxOutputStream extends OutputStream { | |||||
| * The per-thread output stream. | * The per-thread output stream. | ||||
| */ | */ | ||||
| private ByteArrayOutputStream buffer; | private ByteArrayOutputStream buffer; | ||||
| /** | |||||
| /** | |||||
| * Whether or not the next line-terminator should be skipped in terms | * Whether or not the next line-terminator should be skipped in terms | ||||
| * of processing the buffer. Used to avoid \r\n invoking | * of processing the buffer. Used to avoid \r\n invoking | ||||
| * processBuffer twice. | * processBuffer twice. | ||||
| */ | */ | ||||
| private boolean skip = false; | private boolean skip = false; | ||||
| } | } | ||||
| /** Maximum buffer size. */ | /** Maximum buffer size. */ | ||||
| private static final int MAX_SIZE = 1024; | private static final int MAX_SIZE = 1024; | ||||
| /** Mapping from thread to buffer (Thread to BufferInfo). */ | /** Mapping from thread to buffer (Thread to BufferInfo). */ | ||||
| private Hashtable buffers = new Hashtable(); | private Hashtable buffers = new Hashtable(); | ||||
| @@ -102,14 +102,14 @@ public class DemuxOutputStream extends OutputStream { | |||||
| * Whether or not this stream represents an error stream. | * Whether or not this stream represents an error stream. | ||||
| */ | */ | ||||
| private boolean isErrorStream; | private boolean isErrorStream; | ||||
| /** | /** | ||||
| * Creates a new instance of this class. | * Creates a new instance of this class. | ||||
| * | * | ||||
| * @param project The project instance for which output is being | |||||
| * @param project The project instance for which output is being | |||||
| * demultiplexed. Must not be <code>null</code>. | * demultiplexed. Must not be <code>null</code>. | ||||
| * @param isErrorStream <code>true</code> if this is the error string, | |||||
| * otherwise a normal output stream. This is | |||||
| * @param isErrorStream <code>true</code> if this is the error string, | |||||
| * otherwise a normal output stream. This is | |||||
| * passed to the project so it knows | * passed to the project so it knows | ||||
| * which stream it is receiving. | * which stream it is receiving. | ||||
| */ | */ | ||||
| @@ -120,7 +120,7 @@ public class DemuxOutputStream extends OutputStream { | |||||
| /** | /** | ||||
| * Returns the buffer associated with the current thread. | * Returns the buffer associated with the current thread. | ||||
| * | |||||
| * | |||||
| * @return a BufferInfo for the current thread to write data to | * @return a BufferInfo for the current thread to write data to | ||||
| */ | */ | ||||
| private BufferInfo getBufferInfo() { | private BufferInfo getBufferInfo() { | ||||
| @@ -138,7 +138,7 @@ public class DemuxOutputStream extends OutputStream { | |||||
| /** | /** | ||||
| * Resets the buffer for the current thread. | * Resets the buffer for the current thread. | ||||
| */ | */ | ||||
| private void resetBufferInfo() { | |||||
| private void resetBufferInfo() { | |||||
| Thread current = Thread.currentThread(); | Thread current = Thread.currentThread(); | ||||
| BufferInfo bufferInfo = (BufferInfo) buffers.get(current); | BufferInfo bufferInfo = (BufferInfo) buffers.get(current); | ||||
| try { | try { | ||||
| @@ -149,11 +149,11 @@ public class DemuxOutputStream extends OutputStream { | |||||
| bufferInfo.buffer = new ByteArrayOutputStream(); | bufferInfo.buffer = new ByteArrayOutputStream(); | ||||
| bufferInfo.skip = false; | bufferInfo.skip = false; | ||||
| } | } | ||||
| /** | /** | ||||
| * Removes the buffer for the current thread. | * Removes the buffer for the current thread. | ||||
| */ | */ | ||||
| private void removeBuffer() { | |||||
| private void removeBuffer() { | |||||
| Thread current = Thread.currentThread(); | Thread current = Thread.currentThread(); | ||||
| buffers.remove (current); | buffers.remove (current); | ||||
| } | } | ||||
| @@ -187,7 +187,7 @@ public class DemuxOutputStream extends OutputStream { | |||||
| * | * | ||||
| * @param buffer the ByteArrayOutputStream used to collect the output | * @param buffer the ByteArrayOutputStream used to collect the output | ||||
| * until a line separator is seen. | * until a line separator is seen. | ||||
| * | |||||
| * | |||||
| * @see Project#demuxOutput(String,boolean) | * @see Project#demuxOutput(String,boolean) | ||||
| */ | */ | ||||
| protected void processBuffer(ByteArrayOutputStream buffer) { | protected void processBuffer(ByteArrayOutputStream buffer) { | ||||
| @@ -201,7 +201,7 @@ public class DemuxOutputStream extends OutputStream { | |||||
| * | * | ||||
| * @param buffer the ByteArrayOutputStream used to collect the output | * @param buffer the ByteArrayOutputStream used to collect the output | ||||
| * until a line separator is seen. | * until a line separator is seen. | ||||
| * | |||||
| * | |||||
| * @see Project#demuxOutput(String,boolean) | * @see Project#demuxOutput(String,boolean) | ||||
| */ | */ | ||||
| protected void processFlush(ByteArrayOutputStream buffer) { | protected void processFlush(ByteArrayOutputStream buffer) { | ||||
| @@ -214,7 +214,7 @@ public class DemuxOutputStream extends OutputStream { | |||||
| * Equivalent to flushing the stream. | * Equivalent to flushing the stream. | ||||
| * | * | ||||
| * @exception IOException if there is a problem closing the stream. | * @exception IOException if there is a problem closing the stream. | ||||
| * | |||||
| * | |||||
| * @see #flush | * @see #flush | ||||
| */ | */ | ||||
| public void close() throws IOException { | public void close() throws IOException { | ||||
| @@ -77,11 +77,11 @@ import java.lang.reflect.InvocationTargetException; | |||||
| */ | */ | ||||
| public final class Diagnostics { | public final class Diagnostics { | ||||
| private static final String TEST_CLASS | |||||
| private static final String TEST_CLASS | |||||
| = "org.apache.tools.ant.taskdefs.optional.Test"; | = "org.apache.tools.ant.taskdefs.optional.Test"; | ||||
| /** utility class */ | /** utility class */ | ||||
| private Diagnostics(){ | |||||
| private Diagnostics() { | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -92,7 +92,7 @@ public final class Diagnostics { | |||||
| public static boolean isOptionalAvailable() { | public static boolean isOptionalAvailable() { | ||||
| try { | try { | ||||
| Class.forName(TEST_CLASS); | Class.forName(TEST_CLASS); | ||||
| } catch (ClassNotFoundException e){ | |||||
| } catch (ClassNotFoundException e) { | |||||
| return false; | return false; | ||||
| } | } | ||||
| return true; | return true; | ||||
| @@ -105,19 +105,19 @@ public final class Diagnostics { | |||||
| */ | */ | ||||
| public static void validateVersion() throws BuildException { | public static void validateVersion() throws BuildException { | ||||
| try { | try { | ||||
| Class optional | |||||
| Class optional | |||||
| = Class.forName("org.apache.tools.ant.taskdefs.optional.Test"); | = Class.forName("org.apache.tools.ant.taskdefs.optional.Test"); | ||||
| String coreVersion = getImplementationVersion(Main.class); | String coreVersion = getImplementationVersion(Main.class); | ||||
| String optionalVersion = getImplementationVersion(optional); | String optionalVersion = getImplementationVersion(optional); | ||||
| if (coreVersion != null && !coreVersion.equals(optionalVersion)) { | 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; | return null; | ||||
| } | } | ||||
| File[] files = new File[filenames.length]; | 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]); | files[i] = new File(libDir, filenames[i]); | ||||
| } | } | ||||
| return files; | return files; | ||||
| @@ -154,7 +154,7 @@ public final class Diagnostics { | |||||
| * main entry point for command line | * main entry point for command line | ||||
| * @param args command line arguments. | * @param args command line arguments. | ||||
| */ | */ | ||||
| public static void main(String[] args){ | |||||
| public static void main(String[] args) { | |||||
| doReport(System.out); | doReport(System.out); | ||||
| } | } | ||||
| @@ -165,18 +165,18 @@ public final class Diagnostics { | |||||
| * @return null if there is no package or implementation version. | * @return null if there is no package or implementation version. | ||||
| * '?.?' for JDK 1.0 or 1.1. | * '?.?' for JDK 1.0 or 1.1. | ||||
| */ | */ | ||||
| private static String getImplementationVersion(Class clazz){ | |||||
| private static String getImplementationVersion(Class clazz) { | |||||
| try { | try { | ||||
| // Package pkg = clazz.getPackage(); | |||||
| // Package pkg = clazz.getPackage(); | |||||
| Method method = Class.class.getMethod("getPackage", new Class[0]); | Method method = Class.class.getMethod("getPackage", new Class[0]); | ||||
| Object pkg = method.invoke(clazz, null); | Object pkg = method.invoke(clazz, null); | ||||
| if (pkg != null) { | if (pkg != null) { | ||||
| // pkg.getImplementationVersion(); | // pkg.getImplementationVersion(); | ||||
| method = pkg.getClass().getMethod("getImplementationVersion", new Class[0]); | method = pkg.getClass().getMethod("getImplementationVersion", new Class[0]); | ||||
| Object version = method.invoke(pkg, null); | |||||
| Object version = method.invoke(pkg, null); | |||||
| return (String) version; | return (String) version; | ||||
| } | } | ||||
| } catch (Exception e){ | |||||
| } catch (Exception e) { | |||||
| // JDK < 1.2 should land here because the methods above don't exist. | // JDK < 1.2 should land here because the methods above don't exist. | ||||
| return "?.?"; | return "?.?"; | ||||
| } | } | ||||
| @@ -211,6 +211,7 @@ public final class Diagnostics { | |||||
| try { | try { | ||||
| saxParser = saxParserFactory.newSAXParser(); | saxParser = saxParserFactory.newSAXParser(); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| // ignore | |||||
| } | } | ||||
| return saxParser; | return saxParser; | ||||
| } | } | ||||
| @@ -245,7 +246,7 @@ public final class Diagnostics { | |||||
| * Print a report to the given stream. | * Print a report to the given stream. | ||||
| * @param out the stream to print the report to. | * @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("------- Ant diagnostics report -------"); | ||||
| out.println(Main.getAntVersion()); | out.println(Main.getAntVersion()); | ||||
| out.println(); | out.println(); | ||||
| @@ -258,9 +259,9 @@ public final class Diagnostics { | |||||
| try { | try { | ||||
| optional = Class.forName( | optional = Class.forName( | ||||
| "org.apache.tools.ant.taskdefs.optional.Test"); | "org.apache.tools.ant.taskdefs.optional.Test"); | ||||
| out.println("optional tasks : " | |||||
| out.println("optional tasks : " | |||||
| + getImplementationVersion(optional)); | + getImplementationVersion(optional)); | ||||
| } catch (ClassNotFoundException e){ | |||||
| } catch (ClassNotFoundException e) { | |||||
| out.println("optional tasks : not available"); | 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. | * Report a listing of system properties existing in the current vm. | ||||
| * @param out the stream to print the properties to. | * @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(); | for (Enumeration keys = System.getProperties().keys(); | ||||
| keys.hasMoreElements();) { | keys.hasMoreElements();) { | ||||
| String key = (String) keys.nextElement(); | String key = (String) keys.nextElement(); | ||||
| @@ -315,14 +316,14 @@ public final class Diagnostics { | |||||
| * Report the content of ANT_HOME/lib directory | * Report the content of ANT_HOME/lib directory | ||||
| * @param out the stream to print the content to | * @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")); | out.println("ant.home: " + System.getProperty("ant.home")); | ||||
| File[] libs = listLibraries(); | File[] libs = listLibraries(); | ||||
| if (libs == null) { | if (libs == null) { | ||||
| out.println("Unable to list libraries."); | out.println("Unable to list libraries."); | ||||
| return; | return; | ||||
| } | } | ||||
| for (int i = 0; i < libs.length; i++){ | |||||
| for (int i = 0; i < libs.length; i++) { | |||||
| out.println(libs[i].getName() | out.println(libs[i].getName() | ||||
| + " (" + libs[i].length() + " bytes)"); | + " (" + libs[i].length() + " bytes)"); | ||||
| } | } | ||||
| @@ -333,12 +334,12 @@ public final class Diagnostics { | |||||
| * Call org.apache.env.Which if available | * Call org.apache.env.Which if available | ||||
| * @param out the stream to print the content to. | * @param out the stream to print the content to. | ||||
| */ | */ | ||||
| private static void doReportWhich(PrintStream out){ | |||||
| private static void doReportWhich(PrintStream out) { | |||||
| Throwable error = null; | Throwable error = null; | ||||
| try { | try { | ||||
| Class which = Class.forName("org.apache.env.Which"); | 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[]{}}); | method.invoke(null, new Object[]{new String[]{}}); | ||||
| } catch (ClassNotFoundException e) { | } catch (ClassNotFoundException e) { | ||||
| out.println("Not available."); | out.println("Not available."); | ||||
| @@ -363,7 +364,7 @@ public final class Diagnostics { | |||||
| * @param out the stream to print the tasks report to | * @param out the stream to print the tasks report to | ||||
| * <tt>null</tt> for a missing stream (ie mapping). | * <tt>null</tt> for a missing stream (ie mapping). | ||||
| */ | */ | ||||
| private static void doReportTasksAvailability(PrintStream out){ | |||||
| private static void doReportTasksAvailability(PrintStream out) { | |||||
| InputStream is = Main.class.getResourceAsStream( | InputStream is = Main.class.getResourceAsStream( | ||||
| "/org/apache/tools/ant/taskdefs/defaults.properties"); | "/org/apache/tools/ant/taskdefs/defaults.properties"); | ||||
| if (is == null) { | if (is == null) { | ||||
| @@ -372,13 +373,13 @@ public final class Diagnostics { | |||||
| Properties props = new Properties(); | Properties props = new Properties(); | ||||
| try { | try { | ||||
| props.load(is); | props.load(is); | ||||
| for (Enumeration keys = props.keys(); keys.hasMoreElements();){ | |||||
| for (Enumeration keys = props.keys(); keys.hasMoreElements();) { | |||||
| String key = (String) keys.nextElement(); | String key = (String) keys.nextElement(); | ||||
| String classname = props.getProperty(key); | String classname = props.getProperty(key); | ||||
| try { | try { | ||||
| Class.forName(classname); | Class.forName(classname); | ||||
| props.remove(key); | props.remove(key); | ||||
| } catch (ClassNotFoundException e){ | |||||
| } catch (ClassNotFoundException e) { | |||||
| out.println(key + " : Not Available"); | out.println(key + " : Not Available"); | ||||
| } catch (NoClassDefFoundError e) { | } catch (NoClassDefFoundError e) { | ||||
| String pkg = e.getMessage().replace('/', '.'); | String pkg = e.getMessage().replace('/', '.'); | ||||
| @@ -387,10 +388,10 @@ public final class Diagnostics { | |||||
| out.println(key + " : Initialization error"); | out.println(key + " : Initialization error"); | ||||
| } | } | ||||
| } | } | ||||
| if (props.size() == 0){ | |||||
| if (props.size() == 0) { | |||||
| out.println("All defined tasks are available"); | out.println("All defined tasks are available"); | ||||
| } | } | ||||
| } catch (IOException e){ | |||||
| } catch (IOException e) { | |||||
| out.println(e.getMessage()); | out.println(e.getMessage()); | ||||
| } | } | ||||
| } | } | ||||
| @@ -152,7 +152,7 @@ import org.apache.tools.ant.util.FileUtils; | |||||
| * @author <a href="mailto:bruce@callenish.com">Bruce Atherton</a> | * @author <a href="mailto:bruce@callenish.com">Bruce Atherton</a> | ||||
| * @author <a href="mailto:levylambert@tiscali-dsl.de">Antoine Levy-Lambert</a> | * @author <a href="mailto:levylambert@tiscali-dsl.de">Antoine Levy-Lambert</a> | ||||
| */ | */ | ||||
| public class DirectoryScanner | |||||
| public class DirectoryScanner | |||||
| implements FileScanner, SelectorScanner, ResourceFactory { | implements FileScanner, SelectorScanner, ResourceFactory { | ||||
| @@ -174,7 +174,7 @@ public class DirectoryScanner | |||||
| "**/.#*", | "**/.#*", | ||||
| "**/%*%", | "**/%*%", | ||||
| "**/._*", | "**/._*", | ||||
| // CVS | // CVS | ||||
| "**/CVS", | "**/CVS", | ||||
| "**/CVS/**", | "**/CVS/**", | ||||
| @@ -200,7 +200,7 @@ public class DirectoryScanner | |||||
| * | * | ||||
| * @see #addDefaultExcludes() | * @see #addDefaultExcludes() | ||||
| */ | */ | ||||
| private static Vector defaultExcludes = new Vector(); | |||||
| private static Vector defaultExcludes = new Vector(); | |||||
| static { | static { | ||||
| for (int i = 0; i < DEFAULTEXCLUDES.length; i++) { | 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. | * Get the list of patterns that should be excluded by default. | ||||
| * | * | ||||
| * @return An array of <code>String</code> based on the current | |||||
| * contents of the <code>defaultExcludes</code> | |||||
| * @return An array of <code>String</code> based on the current | |||||
| * contents of the <code>defaultExcludes</code> | |||||
| * <code>Vector</code>. | * <code>Vector</code>. | ||||
| * | * | ||||
| * @since Ant 1.6 | * @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. | * default exclude. | ||||
| * | * | ||||
| * @param s A string to add as an exclude pattern. | * @param s A string to add as an exclude pattern. | ||||
| * @return <code>true</code> if the string was added | |||||
| * @return <code>true</code> if the string was added | |||||
| * <code>false</code> if it already | * <code>false</code> if it already | ||||
| * existed. | * existed. | ||||
| * | * | ||||
| * @since Ant 1.6 | * @since Ant 1.6 | ||||
| */ | */ | ||||
| public static boolean addDefaultExclude(String s){ | |||||
| public static boolean addDefaultExclude(String s) { | |||||
| if (defaultExcludes.indexOf(s) == -1) { | if (defaultExcludes.indexOf(s) == -1) { | ||||
| defaultExcludes.add(s); | defaultExcludes.add(s); | ||||
| return true; | return true; | ||||
| @@ -439,7 +439,7 @@ public class DirectoryScanner | |||||
| * Remove a string if it is a default exclude. | * Remove a string if it is a default exclude. | ||||
| * | * | ||||
| * @param s The string to attempt to remove. | * @param s The string to attempt to remove. | ||||
| * @return <code>true</code> if <code>s</code> was a default | |||||
| * @return <code>true</code> if <code>s</code> was a default | |||||
| * exclude (and thus was removed), | * exclude (and thus was removed), | ||||
| * <code>false</code> if <code>s</code> was not | * <code>false</code> if <code>s</code> was not | ||||
| * in the default excludes list to begin with | * in the default excludes list to begin with | ||||
| @@ -859,7 +859,7 @@ public class DirectoryScanner | |||||
| protected boolean isSelected(String name, File file) { | protected boolean isSelected(String name, File file) { | ||||
| if (selectors != null) { | if (selectors != null) { | ||||
| for (int i = 0; i < selectors.length; i++) { | 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; | return false; | ||||
| } | } | ||||
| } | } | ||||
| @@ -1013,7 +1013,7 @@ public class DirectoryScanner | |||||
| } | } | ||||
| String[] defaultExcludesTemp = getDefaultExcludes(); | String[] defaultExcludesTemp = getDefaultExcludes(); | ||||
| for (int i = 0; i < defaultExcludesTemp.length; i++) { | for (int i = 0; i < defaultExcludesTemp.length; i++) { | ||||
| newExcludes[i + excludesLength] = | |||||
| newExcludes[i + excludesLength] = | |||||
| defaultExcludesTemp[i].replace('/', File.separatorChar) | defaultExcludesTemp[i].replace('/', File.separatorChar) | ||||
| .replace('\\', File.separatorChar); | .replace('\\', File.separatorChar); | ||||
| } | } | ||||
| @@ -1029,7 +1029,7 @@ public class DirectoryScanner | |||||
| */ | */ | ||||
| public Resource getResource(String name) { | public Resource getResource(String name) { | ||||
| File f = fileUtils.resolveFile(basedir, 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()); | f.isDirectory()); | ||||
| } | } | ||||
| @@ -61,14 +61,14 @@ package org.apache.tools.ant; | |||||
| * @since Ant 1.5 | * @since Ant 1.5 | ||||
| */ | */ | ||||
| public interface DynamicConfigurator { | public interface DynamicConfigurator { | ||||
| /** | /** | ||||
| * Set a named attribute to the given value | * Set a named attribute to the given value | ||||
| * | |||||
| * | |||||
| * @param name the name of the attribute | * @param name the name of the attribute | ||||
| * @param value the new value of the attribute | * @param value the new value of the attribute | ||||
| * @throws BuildException when any error occurs | * @throws BuildException when any error occurs | ||||
| */ | |||||
| */ | |||||
| void setDynamicAttribute(String name, String value) | void setDynamicAttribute(String name, String value) | ||||
| throws BuildException; | throws BuildException; | ||||
| @@ -78,6 +78,6 @@ public interface DynamicConfigurator { | |||||
| * @param name the element nbame | * @param name the element nbame | ||||
| * @throws BuildException when any error occurs | * @throws BuildException when any error occurs | ||||
| * @return the element created | * @return the element created | ||||
| */ | |||||
| */ | |||||
| Object createDynamicElement(String name) throws BuildException; | Object createDynamicElement(String name) throws BuildException; | ||||
| } | } | ||||
| @@ -56,46 +56,48 @@ package org.apache.tools.ant; | |||||
| import java.io.File; | 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. | * directory scanner. | ||||
| * | |||||
| * @author Apache Ant | |||||
| */ | */ | ||||
| public interface FileScanner { | public interface FileScanner { | ||||
| /** | /** | ||||
| * Adds default exclusions to the current exclusions set. | * Adds default exclusions to the current exclusions set. | ||||
| */ | */ | ||||
| void addDefaultExcludes(); | void addDefaultExcludes(); | ||||
| /** | /** | ||||
| * Returns the base directory to be scanned. | |||||
| * Returns the base directory to be scanned. | |||||
| * This is the directory which is scanned recursively. | * This is the directory which is scanned recursively. | ||||
| * | * | ||||
| * @return the base directory to be scanned | * @return the base directory to be scanned | ||||
| */ | */ | ||||
| File getBasedir(); | 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. | * include patterns and at least one of the exclude patterns. | ||||
| * The names are relative to the base directory. | * 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. | * include patterns and at least one of the exclude patterns. | ||||
| */ | */ | ||||
| String[] getExcludedDirectories(); | 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. | * include patterns and at least one of the exclude patterns. | ||||
| * The names are relative to the base directory. | * 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. | * include patterns and at at least one of the exclude patterns. | ||||
| * | |||||
| */ | |||||
| * | |||||
| */ | |||||
| String[] getExcludedFiles(); | 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. | * include patterns and none of the exclude patterns. | ||||
| * The names are relative to the base directory. | * The names are relative to the base directory. | ||||
| * | * | ||||
| @@ -103,9 +105,9 @@ public interface FileScanner { | |||||
| * include patterns and none of the exclude patterns. | * include patterns and none of the exclude patterns. | ||||
| */ | */ | ||||
| String[] getIncludedDirectories(); | 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. | * include patterns and none of the exclude patterns. | ||||
| * The names are relative to the base directory. | * The names are relative to the base directory. | ||||
| * | * | ||||
| @@ -113,72 +115,72 @@ public interface FileScanner { | |||||
| * include patterns and none of the exclude patterns. | * include patterns and none of the exclude patterns. | ||||
| */ | */ | ||||
| String[] getIncludedFiles(); | String[] getIncludedFiles(); | ||||
| /** | /** | ||||
| * Returns the names of the directories which matched none of the include | * Returns the names of the directories which matched none of the include | ||||
| * patterns. The names are relative to the base directory. | * patterns. The names are relative to the base directory. | ||||
| * | * | ||||
| * @return the names of the directories which matched none of the include | * @return the names of the directories which matched none of the include | ||||
| * patterns. | * patterns. | ||||
| */ | |||||
| */ | |||||
| String[] getNotIncludedDirectories(); | 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. | * 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. | * patterns. | ||||
| */ | */ | ||||
| String[] getNotIncludedFiles(); | String[] getNotIncludedFiles(); | ||||
| /** | /** | ||||
| * Scans the base directory for files which match at least one include | * Scans the base directory for files which match at least one include | ||||
| * pattern and don't match any exclude patterns. | * pattern and don't match any exclude patterns. | ||||
| * | * | ||||
| * @exception IllegalStateException if the base directory was set | |||||
| * @exception IllegalStateException if the base directory was set | |||||
| * incorrectly (i.e. if it is <code>null</code>, doesn't exist, | * incorrectly (i.e. if it is <code>null</code>, doesn't exist, | ||||
| * or isn't a directory). | * or isn't a directory). | ||||
| */ | */ | ||||
| void scan() throws IllegalStateException; | void scan() throws IllegalStateException; | ||||
| /** | /** | ||||
| * 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. All '/' and '\' characters should be replaced by | * scanned recursively. All '/' and '\' characters should be replaced by | ||||
| * <code>File.separatorChar</code>, so the separator used need not match | * <code>File.separatorChar</code>, so the separator used need not match | ||||
| * <code>File.separatorChar</code>. | * <code>File.separatorChar</code>. | ||||
| * | * | ||||
| * @param basedir The base directory to scan. | |||||
| * @param basedir The base directory to scan. | |||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| */ | */ | ||||
| void setBasedir(String basedir); | 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. | * scanned recursively. | ||||
| * | * | ||||
| * @param basedir The base directory for scanning. | |||||
| * @param basedir The base directory for scanning. | |||||
| * Should not be <code>null</code>. | * Should not be <code>null</code>. | ||||
| */ | */ | ||||
| void setBasedir(File basedir); | void setBasedir(File basedir); | ||||
| /** | /** | ||||
| * Sets the list of exclude patterns to use. | * Sets the list of exclude patterns to use. | ||||
| * | * | ||||
| * @param excludes A list of exclude patterns. | |||||
| * May be <code>null</code>, indicating that no files | |||||
| * should be excluded. If a non-<code>null</code> list is | |||||
| * @param excludes A list of exclude patterns. | |||||
| * May be <code>null</code>, indicating that no files | |||||
| * should be excluded. If a non-<code>null</code> list is | |||||
| * given, all elements must be non-<code>null</code>. | * given, all elements must be non-<code>null</code>. | ||||
| */ | |||||
| */ | |||||
| void setExcludes(String[] excludes); | void setExcludes(String[] excludes); | ||||
| /** | /** | ||||
| * Sets the list of include patterns to use. | * Sets the list of include patterns to use. | ||||
| * | * | ||||
| * @param includes A list of include patterns. | * @param includes A list of include patterns. | ||||
| * May be <code>null</code>, indicating that all files | |||||
| * May be <code>null</code>, indicating that all files | |||||
| * should be included. If a non-<code>null</code> | * should be included. If a non-<code>null</code> | ||||
| * list is given, all elements must be | |||||
| * list is given, all elements must be | |||||
| * non-<code>null</code>. | * non-<code>null</code>. | ||||
| */ | */ | ||||
| void setIncludes(String[] includes); | void setIncludes(String[] includes); | ||||
| @@ -186,7 +188,7 @@ public interface FileScanner { | |||||
| /** | /** | ||||
| * Sets whether or not the file system should be regarded as case sensitive. | * 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 | * regarded as a case sensitive one | ||||
| */ | */ | ||||
| void setCaseSensitive(boolean isCaseSensitive); | void setCaseSensitive(boolean isCaseSensitive); | ||||
| @@ -1073,7 +1073,7 @@ public class IntrospectionHelper implements BuildListener { | |||||
| } | } | ||||
| addTypeMethods.add(method); | addTypeMethods.add(method); | ||||
| } | } | ||||
| /** | /** | ||||
| * Search the list of methods to find the first 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) { | private Method findMatchingMethod(Class paramClass, List methods) { | ||||
| Class matchedClass = null; | Class matchedClass = null; | ||||
| Method matchedMethod = null; | Method matchedMethod = null; | ||||
| for (int i = 0; i < methods.size(); ++i) { | for (int i = 0; i < methods.size(); ++i) { | ||||
| Method method = (Method) methods.get(i); | Method method = (Method) methods.get(i); | ||||
| Class methodClass = method.getParameterTypes()[0]; | Class methodClass = method.getParameterTypes()[0]; | ||||
| @@ -66,7 +66,7 @@ import org.xml.sax.Locator; | |||||
| * @author Matt Foemmel | * @author Matt Foemmel | ||||
| */ | */ | ||||
| public class Location implements Serializable { | public class Location implements Serializable { | ||||
| /** Name of the file. */ | /** Name of the file. */ | ||||
| private String fileName; | private String fileName; | ||||
| /** Line number within the file. */ | /** 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 | * Creates a location consisting of a file name but no line number or | ||||
| * column number. | * column number. | ||||
| * | |||||
| * | |||||
| * @param fileName The name of the file. May be <code>null</code>, | * @param fileName The name of the file. May be <code>null</code>, | ||||
| * in which case the location is equivalent to | * in which case the location is equivalent to | ||||
| * {@link #UNKNOWN_LOCATION UNKNOWN_LOCATION}. | * {@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 | * Creates a location from the SAX locator using the system ID as | ||||
| * the filename. | * the filename. | ||||
| * | |||||
| * | |||||
| * @param loc Must not be <code>null</code>. | * @param loc Must not be <code>null</code>. | ||||
| * | * | ||||
| * @since Ant 1.6 | * @since Ant 1.6 | ||||
| @@ -111,11 +111,11 @@ public class Location implements Serializable { | |||||
| /** | /** | ||||
| * Creates a location consisting of a file name, line number and | * Creates a location consisting of a file name, line number and | ||||
| * column number. | * column number. | ||||
| * | |||||
| * | |||||
| * @param fileName The name of the file. May be <code>null</code>, | * @param fileName The name of the file. May be <code>null</code>, | ||||
| * in which case the location is equivalent to | * in which case the location is equivalent to | ||||
| * {@link #UNKNOWN_LOCATION UNKNOWN_LOCATION}. | * {@link #UNKNOWN_LOCATION UNKNOWN_LOCATION}. | ||||
| * | |||||
| * | |||||
| * @param lineNumber Line number within the file. Use 0 for unknown | * @param lineNumber Line number within the file. Use 0 for unknown | ||||
| * positions within a file. | * positions within a file. | ||||
| * @param columnNumber Column number within the line. | * @param columnNumber Column number within the line. | ||||
| @@ -125,16 +125,16 @@ public class Location implements Serializable { | |||||
| this.fileName = FileUtils.newFileUtils().fromURI(fileName); | this.fileName = FileUtils.newFileUtils().fromURI(fileName); | ||||
| } else { | } else { | ||||
| this.fileName = fileName; | this.fileName = fileName; | ||||
| } | |||||
| } | |||||
| this.lineNumber = lineNumber; | this.lineNumber = lineNumber; | ||||
| this.columnNumber = columnNumber; | 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. | * empty string is returned. | ||||
| * | |||||
| * | |||||
| * @return a String of the form <code>"fileName: lineNumber: "</code> | * @return a String of the form <code>"fileName: lineNumber: "</code> | ||||
| * if both file name and line number are known, | * if both file name and line number are known, | ||||
| * <code>"fileName: "</code> if only the file name is known, | * <code>"fileName: "</code> if only the file name is known, | ||||
| @@ -112,7 +112,7 @@ public class Main implements AntMain { | |||||
| /** Indicates whether this build is to support interactive input */ | /** Indicates whether this build is to support interactive input */ | ||||
| private boolean allowInput = true; | private boolean allowInput = true; | ||||
| /** | /** | ||||
| * The Ant logger class. There may be only one logger. It will have | * 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 | * 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(); | Main m = new Main(); | ||||
| m.startAnt(args, additionalUserProperties, coreLoader); | m.startAnt(args, additionalUserProperties, coreLoader); | ||||
| } | } | ||||
| /** | /** | ||||
| * Start Ant | * Start Ant | ||||
| * @param args command line args | * @param args command line args | ||||
| @@ -189,7 +189,7 @@ public class Main implements AntMain { | |||||
| * @param coreLoader - not used | * @param coreLoader - not used | ||||
| * | * | ||||
| * @since Ant 1.6 | * @since Ant 1.6 | ||||
| */ | |||||
| */ | |||||
| public void startAnt(String[] args, Properties additionalUserProperties, | public void startAnt(String[] args, Properties additionalUserProperties, | ||||
| ClassLoader coreLoader) { | ClassLoader coreLoader) { | ||||
| @@ -270,7 +270,7 @@ public class Main implements AntMain { | |||||
| */ | */ | ||||
| public Main() { | public Main() { | ||||
| } | } | ||||
| /** | /** | ||||
| * Sole constructor, which parses and deals with command line | * Sole constructor, which parses and deals with command line | ||||
| * arguments. | * arguments. | ||||
| @@ -283,7 +283,7 @@ public class Main implements AntMain { | |||||
| protected Main(String[] args) throws BuildException { | protected Main(String[] args) throws BuildException { | ||||
| processArgs(args); | processArgs(args); | ||||
| } | } | ||||
| /** | /** | ||||
| * Process command line arguments | * Process command line arguments | ||||
| * | * | ||||
| @@ -610,7 +610,7 @@ public class Main implements AntMain { | |||||
| //System.setSecurityManager(new NoExitSecurityManager()); | //System.setSecurityManager(new NoExitSecurityManager()); | ||||
| } | } | ||||
| try { | try { | ||||
| if (allowInput) { | |||||
| if (allowInput) { | |||||
| project.setDefaultInputStream(System.in); | project.setDefaultInputStream(System.in); | ||||
| } | } | ||||
| System.setIn(new DemuxInputStream(project)); | System.setIn(new DemuxInputStream(project)); | ||||
| @@ -63,11 +63,11 @@ import org.apache.tools.ant.util.StringUtils; | |||||
| */ | */ | ||||
| public class NoBannerLogger extends DefaultLogger { | public class NoBannerLogger extends DefaultLogger { | ||||
| /** | |||||
| /** | |||||
| * Name of the current target, if it should | * Name of the current target, if it should | ||||
| * be displayed on the next message. This is | * be displayed on the next message. This is | ||||
| * set when a target starts building, and reset | * set when a target starts building, and reset | ||||
| * to <code>null</code> after the first message for | |||||
| * to <code>null</code> after the first message for | |||||
| * the target is logged. | * the target is logged. | ||||
| */ | */ | ||||
| protected String targetName; | protected String targetName; | ||||
| @@ -79,7 +79,7 @@ public class NoBannerLogger extends DefaultLogger { | |||||
| /** | /** | ||||
| * Notes the name of the target so it can be logged | * Notes the name of the target so it can be logged | ||||
| * if it generates any messages. | * if it generates any messages. | ||||
| * | |||||
| * | |||||
| * @param event A BuildEvent containing target information. | * @param event A BuildEvent containing target information. | ||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| */ | */ | ||||
| @@ -87,9 +87,9 @@ public class NoBannerLogger extends DefaultLogger { | |||||
| targetName = event.getTarget().getName(); | targetName = event.getTarget().getName(); | ||||
| } | } | ||||
| /** | |||||
| /** | |||||
| * Resets the current target name to <code>null</code>. | * Resets the current target name to <code>null</code>. | ||||
| * | |||||
| * | |||||
| * @param event Ignored in this implementation. | * @param event Ignored in this implementation. | ||||
| */ | */ | ||||
| public void targetFinished(BuildEvent event) { | public void targetFinished(BuildEvent event) { | ||||
| @@ -101,14 +101,14 @@ public class NoBannerLogger extends DefaultLogger { | |||||
| * priority, also logging the name of the target if this | * priority, also logging the name of the target if this | ||||
| * is the first message which needs to be logged for the | * is the first message which needs to be logged for the | ||||
| * target. | * target. | ||||
| * | |||||
| * | |||||
| * @param event A BuildEvent containing message information. | * @param event A BuildEvent containing message information. | ||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| */ | */ | ||||
| public void messageLogged(BuildEvent event) { | public void messageLogged(BuildEvent event) { | ||||
| if (event.getPriority() > msgOutputLevel | |||||
| || null == event.getMessage() | |||||
| if (event.getPriority() > msgOutputLevel | |||||
| || null == event.getMessage() | |||||
| || "".equals(event.getMessage().trim())) { | || "".equals(event.getMessage().trim())) { | ||||
| return; | return; | ||||
| } | } | ||||
| @@ -66,14 +66,14 @@ import org.apache.tools.ant.taskdefs.condition.Os; | |||||
| * of either '/' or '\'. | * of either '/' or '\'. | ||||
| * | * | ||||
| * @author Conor MacNeill | * @author Conor MacNeill | ||||
| * @author <a href="mailto:jtulley@novell.com">Jeff Tulley</a> | |||||
| */ | |||||
| * @author <a href="mailto:jtulley@novell.com">Jeff Tulley</a> | |||||
| */ | |||||
| public class PathTokenizer { | public class PathTokenizer { | ||||
| /** | /** | ||||
| * A tokenizer to break the string up based on the ':' or ';' separators. | * A tokenizer to break the string up based on the ':' or ';' separators. | ||||
| */ | */ | ||||
| private StringTokenizer tokenizer; | private StringTokenizer tokenizer; | ||||
| /** | /** | ||||
| * A String which stores any path components which have been read ahead | * A String which stores any path components which have been read ahead | ||||
| * due to DOS filesystem compensation. | * due to DOS filesystem compensation. | ||||
| @@ -95,12 +95,12 @@ public class PathTokenizer { | |||||
| /** | /** | ||||
| * Constructs a path tokenizer for the specified path. | * Constructs a path tokenizer for the specified path. | ||||
| * | |||||
| * | |||||
| * @param path The path to tokenize. Must not be <code>null</code>. | * @param path The path to tokenize. Must not be <code>null</code>. | ||||
| */ | */ | ||||
| public PathTokenizer(String path) { | public PathTokenizer(String path) { | ||||
| if (onNetWare) { | 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. | // information to make a better decision later. | ||||
| tokenizer = new StringTokenizer(path, ":;", true); | tokenizer = new StringTokenizer(path, ":;", true); | ||||
| } else { | } else { | ||||
| @@ -108,31 +108,31 @@ public class PathTokenizer { | |||||
| // enough information to tokenize correctly. | // enough information to tokenize correctly. | ||||
| tokenizer = new StringTokenizer(path, ":;", false); | tokenizer = new StringTokenizer(path, ":;", false); | ||||
| } | } | ||||
| dosStyleFilesystem = File.pathSeparatorChar == ';'; | |||||
| dosStyleFilesystem = File.pathSeparatorChar == ';'; | |||||
| } | } | ||||
| /** | /** | ||||
| * Tests if there are more path elements available from this tokenizer's | * Tests if there are more path elements available from this tokenizer's | ||||
| * path. If this method returns <code>true</code>, then a subsequent call | |||||
| * path. If this method returns <code>true</code>, then a subsequent call | |||||
| * to nextToken will successfully return a token. | * to nextToken will successfully return a token. | ||||
| * | |||||
| * @return <code>true</code> if and only if there is at least one token | |||||
| * | |||||
| * @return <code>true</code> if and only if there is at least one token | |||||
| * in the string after the current position; <code>false</code> otherwise. | * in the string after the current position; <code>false</code> otherwise. | ||||
| */ | */ | ||||
| public boolean hasMoreTokens() { | public boolean hasMoreTokens() { | ||||
| if (lookahead != null) { | if (lookahead != null) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| return tokenizer.hasMoreTokens(); | return tokenizer.hasMoreTokens(); | ||||
| } | } | ||||
| /** | /** | ||||
| * Returns the next path element from this tokenizer. | * Returns the next path element from this tokenizer. | ||||
| * | |||||
| * | |||||
| * @return 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. | * tokenizer's path. | ||||
| */ | */ | ||||
| public String nextToken() throws NoSuchElementException { | public String nextToken() throws NoSuchElementException { | ||||
| @@ -142,8 +142,8 @@ public class PathTokenizer { | |||||
| lookahead = null; | lookahead = null; | ||||
| } else { | } else { | ||||
| token = tokenizer.nextToken().trim(); | token = tokenizer.nextToken().trim(); | ||||
| } | |||||
| } | |||||
| if (!onNetWare) { | if (!onNetWare) { | ||||
| if (token.length() == 1 && Character.isLetter(token.charAt(0)) | if (token.length() == 1 && Character.isLetter(token.charAt(0)) | ||||
| && dosStyleFilesystem | && dosStyleFilesystem | ||||
| @@ -153,7 +153,7 @@ public class PathTokenizer { | |||||
| String nextToken = tokenizer.nextToken().trim(); | String nextToken = tokenizer.nextToken().trim(); | ||||
| if (nextToken.startsWith("\\") || nextToken.startsWith("/")) { | if (nextToken.startsWith("\\") || nextToken.startsWith("/")) { | ||||
| // we know we are on a DOS style platform and the next path | // 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 | // drive spec | ||||
| token += ":" + nextToken; | token += ":" + nextToken; | ||||
| } else { | } else { | ||||
| @@ -168,15 +168,15 @@ public class PathTokenizer { | |||||
| // ignore ";" and get the next token | // ignore ";" and get the next token | ||||
| token = tokenizer.nextToken().trim(); | token = tokenizer.nextToken().trim(); | ||||
| } | } | ||||
| if (tokenizer.hasMoreTokens()) { | if (tokenizer.hasMoreTokens()) { | ||||
| // this path could be a drive spec, so look at the next token | // this path could be a drive spec, so look at the next token | ||||
| String nextToken = tokenizer.nextToken().trim(); | String nextToken = tokenizer.nextToken().trim(); | ||||
| // make sure we aren't going to get the path separator next | // make sure we aren't going to get the path separator next | ||||
| if (!nextToken.equals(File.pathSeparator)) { | if (!nextToken.equals(File.pathSeparator)) { | ||||
| if (nextToken.equals(":")) { | if (nextToken.equals(":")) { | ||||
| if (!token.startsWith("/") && !token.startsWith("\\")){ | |||||
| if (!token.startsWith("/") && !token.startsWith("\\")){ | |||||
| // it indeed is a drive spec, get the next bit | // it indeed is a drive spec, get the next bit | ||||
| String oneMore = tokenizer.nextToken().trim(); | String oneMore = tokenizer.nextToken().trim(); | ||||
| if (!oneMore.equals(File.pathSeparator)) { | if (!oneMore.equals(File.pathSeparator)) { | ||||
| @@ -198,4 +198,4 @@ public class PathTokenizer { | |||||
| return token; | return token; | ||||
| } | } | ||||
| } | } | ||||
| @@ -95,7 +95,7 @@ public abstract class ProjectComponent { | |||||
| public Project getProject() { | public Project getProject() { | ||||
| return project; | return project; | ||||
| } | } | ||||
| /** | /** | ||||
| * Logs a message with the default (INFO) priority. | * Logs a message with the default (INFO) priority. | ||||
| * | * | ||||
| @@ -109,7 +109,7 @@ public abstract class ProjectComponent { | |||||
| * Logs a mesage with the given priority. | * Logs a mesage with the given priority. | ||||
| * | * | ||||
| * @param msg The message to be logged. Should not be <code>null</code>. | * @param msg The message to be logged. Should not be <code>null</code>. | ||||
| * @param msgLevel the message priority at which this message is | |||||
| * @param msgLevel the message priority at which this message is | |||||
| * to be logged. | * to be logged. | ||||
| */ | */ | ||||
| public void log(String msg, int msgLevel) { | public void log(String msg, int msgLevel) { | ||||
| @@ -79,18 +79,18 @@ public class RuntimeConfigurable implements Serializable { | |||||
| /** Name of the element to configure. */ | /** Name of the element to configure. */ | ||||
| private String elementTag = null; | private String elementTag = null; | ||||
| /** List of child element wrappers. */ | /** List of child element wrappers. */ | ||||
| private List/*<RuntimeConfigurable>*/ children = null; | private List/*<RuntimeConfigurable>*/ children = null; | ||||
| /** The element to configure. It is only used during | /** The element to configure. It is only used during | ||||
| * maybeConfigure. | * maybeConfigure. | ||||
| */ | */ | ||||
| private transient Object wrappedObject = null; | private transient Object wrappedObject = null; | ||||
| /** | |||||
| /** | |||||
| * @deprecated | * @deprecated | ||||
| * XML attributes for the element. | |||||
| * XML attributes for the element. | |||||
| */ | */ | ||||
| private transient AttributeList attributes; | 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 | * XXX under JDK 1.4 you can just use a LinkedHashMap for this purpose -jglick | ||||
| */ | */ | ||||
| private List/*<String>*/ attributeNames = null; | private List/*<String>*/ attributeNames = null; | ||||
| /** Map of attribute names to values */ | /** Map of attribute names to values */ | ||||
| private Map/*<String,String>*/ attributeMap = null; | private Map/*<String,String>*/ attributeMap = null; | ||||
| /** Text appearing within the element. */ | /** Text appearing within the element. */ | ||||
| private StringBuffer characters = null; | private StringBuffer characters = null; | ||||
| /** Indicates if the wrapped object has been configured */ | /** Indicates if the wrapped object has been configured */ | ||||
| private boolean proxyConfigured = false; | private boolean proxyConfigured = false; | ||||
| @@ -239,7 +239,7 @@ public class RuntimeConfigurable implements Serializable { | |||||
| return new EmptyEnumeration(); | return new EmptyEnumeration(); | ||||
| } | } | ||||
| } | } | ||||
| static final class EmptyEnumeration implements Enumeration { | static final class EmptyEnumeration implements Enumeration { | ||||
| public EmptyEnumeration() {} | public EmptyEnumeration() {} | ||||
| public boolean hasMoreElements() { | public boolean hasMoreElements() { | ||||
| @@ -370,7 +370,7 @@ public class RuntimeConfigurable implements Serializable { | |||||
| for (int i = 0; i < attributeNames.size(); i++) { | for (int i = 0; i < attributeNames.size(); i++) { | ||||
| String name = (String) attributeNames.get(i); | String name = (String) attributeNames.get(i); | ||||
| String value = (String) attributeMap.get(name); | String value = (String) attributeMap.get(name); | ||||
| // reflect these into the target | // reflect these into the target | ||||
| value = p.replaceProperties(value); | value = p.replaceProperties(value); | ||||
| try { | try { | ||||
| @@ -420,7 +420,7 @@ public class RuntimeConfigurable implements Serializable { | |||||
| } | } | ||||
| proxyConfigured = true; | proxyConfigured = true; | ||||
| } | } | ||||
| /** | /** | ||||
| * Reconfigure the element, even if it has already been configured. | * Reconfigure the element, even if it has already been configured. | ||||
| * | * | ||||
| @@ -86,11 +86,11 @@ public class Target implements TaskContainer { | |||||
| /** Sole constructor. */ | /** Sole constructor. */ | ||||
| public Target() { | public Target() { | ||||
| } | } | ||||
| /** | |||||
| * Sets the project this target belongs to. | |||||
| * | |||||
| * @param project The project this target belongs to. | |||||
| /** | |||||
| * Sets the project this target belongs to. | |||||
| * | |||||
| * @param project The project this target belongs to. | |||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| */ | */ | ||||
| public void setProject(Project project) { | public void setProject(Project project) { | ||||
| @@ -99,8 +99,8 @@ public class Target implements TaskContainer { | |||||
| /** | /** | ||||
| * Returns the project this target belongs to. | * Returns the project this target belongs to. | ||||
| * | |||||
| * @return The project this target belongs to, or <code>null</code> if | |||||
| * | |||||
| * @return The project this target belongs to, or <code>null</code> if | |||||
| * the project has not been set yet. | * the project has not been set yet. | ||||
| */ | */ | ||||
| public Project getProject() { | public Project getProject() { | ||||
| @@ -110,7 +110,7 @@ public class Target implements TaskContainer { | |||||
| /** | /** | ||||
| * Sets the list of targets this target is dependent on. | * Sets the list of targets this target is dependent on. | ||||
| * The targets themselves are not resolved at this time. | * The targets themselves are not resolved at this time. | ||||
| * | |||||
| * | |||||
| * @param depS A comma-separated list of targets this target | * @param depS A comma-separated list of targets this target | ||||
| * depends on. Must not be <code>null</code>. | * depends on. Must not be <code>null</code>. | ||||
| */ | */ | ||||
| @@ -124,19 +124,19 @@ public class Target implements TaskContainer { | |||||
| // Make sure the dependency is not empty string | // Make sure the dependency is not empty string | ||||
| if (token.equals("") || token.equals(",")) { | if (token.equals("") || token.equals(",")) { | ||||
| throw new BuildException("Syntax Error: Depend " | throw new BuildException("Syntax Error: Depend " | ||||
| + "attribute for target \"" + getName() | |||||
| + "attribute for target \"" + getName() | |||||
| + "\" has an empty string for dependency."); | + "\" has an empty string for dependency."); | ||||
| } | } | ||||
| addDependency(token); | addDependency(token); | ||||
| // Make sure that depends attribute does not | // Make sure that depends attribute does not | ||||
| // end in a , | // end in a , | ||||
| if (tok.hasMoreTokens()) { | if (tok.hasMoreTokens()) { | ||||
| token = tok.nextToken(); | token = tok.nextToken(); | ||||
| if (!tok.hasMoreTokens() || !token.equals(",")) { | 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"); | + "\" ends with a , character"); | ||||
| } | } | ||||
| } | } | ||||
| @@ -146,7 +146,7 @@ public class Target implements TaskContainer { | |||||
| /** | /** | ||||
| * Sets the name of this target. | * Sets the name of this target. | ||||
| * | |||||
| * | |||||
| * @param name The name of this target. Should not be <code>null</code>. | * @param name The name of this target. Should not be <code>null</code>. | ||||
| */ | */ | ||||
| public void setName(String name) { | public void setName(String name) { | ||||
| @@ -155,7 +155,7 @@ public class Target implements TaskContainer { | |||||
| /** | /** | ||||
| * Returns the name of this target. | * Returns the name of this target. | ||||
| * | |||||
| * | |||||
| * @return the name of this target, or <code>null</code> if the | * @return the name of this target, or <code>null</code> if the | ||||
| * name has not been set yet. | * name has not been set yet. | ||||
| */ | */ | ||||
| @@ -165,7 +165,7 @@ public class Target implements TaskContainer { | |||||
| /** | /** | ||||
| * Adds a task to this target. | * Adds a task to this target. | ||||
| * | |||||
| * | |||||
| * @param task The task to be added. Must not be <code>null</code>. | * @param task The task to be added. Must not be <code>null</code>. | ||||
| */ | */ | ||||
| public void addTask(Task task) { | 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. | * Adds the wrapper for a data type element to this target. | ||||
| * | |||||
| * @param r The wrapper for the data type element to be added. | |||||
| * | |||||
| * @param r The wrapper for the data type element to be added. | |||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| */ | */ | ||||
| public void addDataType(RuntimeConfigurable r) { | public void addDataType(RuntimeConfigurable r) { | ||||
| children.add(r); | children.add(r); | ||||
| } | } | ||||
| /** | |||||
| /** | |||||
| * Returns the current set of tasks to be executed by this target. | * Returns the current set of tasks to be executed by this target. | ||||
| * | |||||
| * | |||||
| * @return an array of the tasks currently within this target | * @return an array of the tasks currently within this target | ||||
| */ | */ | ||||
| public Task[] getTasks() { | public Task[] getTasks() { | ||||
| @@ -196,13 +196,13 @@ public class Target implements TaskContainer { | |||||
| tasks.add(o); | tasks.add(o); | ||||
| } | } | ||||
| } | } | ||||
| return (Task[])tasks.toArray(new Task[tasks.size()]); | return (Task[])tasks.toArray(new Task[tasks.size()]); | ||||
| } | } | ||||
| /** | /** | ||||
| * Adds a dependency to this target. | * Adds a dependency to this target. | ||||
| * | |||||
| * | |||||
| * @param dependency The name of a target this target is dependent on. | * @param dependency The name of a target this target is dependent on. | ||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| */ | */ | ||||
| @@ -215,7 +215,7 @@ public class Target implements TaskContainer { | |||||
| /** | /** | ||||
| * Returns an enumeration of the dependencies of this target. | * Returns an enumeration of the dependencies of this target. | ||||
| * | |||||
| * | |||||
| * @return an enumeration of the dependencies of this target | * @return an enumeration of the dependencies of this target | ||||
| */ | */ | ||||
| public Enumeration getDependencies() { | public Enumeration getDependencies() { | ||||
| @@ -234,7 +234,7 @@ public class Target implements TaskContainer { | |||||
| * property <code>foo</code> has value <code>bar</code>, setting | * property <code>foo</code> has value <code>bar</code>, setting | ||||
| * the "if" condition to <code>${foo}_x</code> will mean that the | * the "if" condition to <code>${foo}_x</code> will mean that the | ||||
| * task will only execute if property <code>bar_x</code> is set. | * task will only execute if property <code>bar_x</code> is set. | ||||
| * | |||||
| * | |||||
| * @param property The property condition to test on execution. | * @param property The property condition to test on execution. | ||||
| * May be <code>null</code>, in which case | * May be <code>null</code>, in which case | ||||
| * no "if" test is performed. | * no "if" test is performed. | ||||
| @@ -242,7 +242,7 @@ public class Target implements TaskContainer { | |||||
| public void setIf(String property) { | public void setIf(String property) { | ||||
| this.ifCondition = (property == null) ? "" : property; | this.ifCondition = (property == null) ? "" : property; | ||||
| } | } | ||||
| /** | /** | ||||
| * Sets the "unless" condition to test on execution. This is the | * Sets the "unless" condition to test on execution. This is the | ||||
| * name of a property to test for existence - if the property | * name of a property to test for existence - if the property | ||||
| @@ -251,7 +251,7 @@ public class Target implements TaskContainer { | |||||
| * property <code>foo</code> has value <code>bar</code>, setting | * property <code>foo</code> has value <code>bar</code>, setting | ||||
| * the "unless" condition to <code>${foo}_x</code> will mean that the | * the "unless" condition to <code>${foo}_x</code> will mean that the | ||||
| * task will only execute if property <code>bar_x</code> isn't set. | * task will only execute if property <code>bar_x</code> isn't set. | ||||
| * | |||||
| * | |||||
| * @param property The property condition to test on execution. | * @param property The property condition to test on execution. | ||||
| * May be <code>null</code>, in which case | * May be <code>null</code>, in which case | ||||
| * no "unless" test is performed. | * no "unless" test is performed. | ||||
| @@ -262,9 +262,9 @@ public class Target implements TaskContainer { | |||||
| /** | /** | ||||
| * Sets the description of this target. | * Sets the description of this target. | ||||
| * | |||||
| * @param description The description for this target. | |||||
| * May be <code>null</code>, indicating that no | |||||
| * | |||||
| * @param description The description for this target. | |||||
| * May be <code>null</code>, indicating that no | |||||
| * description is available. | * description is available. | ||||
| */ | */ | ||||
| public void setDescription(String description) { | public void setDescription(String description) { | ||||
| @@ -273,7 +273,7 @@ public class Target implements TaskContainer { | |||||
| /** | /** | ||||
| * Returns the description of this target. | * Returns the description of this target. | ||||
| * | |||||
| * | |||||
| * @return the description of this target, or <code>null</code> if no | * @return the description of this target, or <code>null</code> if no | ||||
| * description is available. | * description is available. | ||||
| */ | */ | ||||
| @@ -283,7 +283,7 @@ public class Target implements TaskContainer { | |||||
| /** | /** | ||||
| * Returns the name of this target. | * Returns the name of this target. | ||||
| * | |||||
| * | |||||
| * @return the name of this target, or <code>null</code> if the | * @return the name of this target, or <code>null</code> if the | ||||
| * name has not been set yet. | * 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" | * method, as it does no checking of its own. If either the "if" | ||||
| * or "unless" test prevents this target from being executed, a verbose | * or "unless" test prevents this target from being executed, a verbose | ||||
| * message is logged giving the reason. It is recommended that clients | * 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. | * appropriate build events are fired. | ||||
| * | |||||
| * | |||||
| * @exception BuildException if any of the tasks fail or if a data type | * @exception BuildException if any of the tasks fail or if a data type | ||||
| * configuration fails. | * configuration fails. | ||||
| * | |||||
| * | |||||
| * @see #performTasks() | * @see #performTasks() | ||||
| * @see #setIf(String) | * @see #setIf(String) | ||||
| * @see #setUnless(String) | * @see #setUnless(String) | ||||
| @@ -321,21 +321,21 @@ public class Target implements TaskContainer { | |||||
| } | } | ||||
| } | } | ||||
| } else if (!testIfCondition()) { | } 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); | + "' not set.", Project.MSG_VERBOSE); | ||||
| } else { | } 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); | + "' set.", Project.MSG_VERBOSE); | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Performs the tasks within this target (if the conditions are met), | * 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. | * execute. | ||||
| * | |||||
| * | |||||
| * @see #execute() | * @see #execute() | ||||
| */ | */ | ||||
| public final void performTasks() { | public final void performTasks() { | ||||
| @@ -348,11 +348,11 @@ public class Target implements TaskContainer { | |||||
| throw exc; | throw exc; | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Replaces all occurrences of the given task in the list | * Replaces all occurrences of the given task in the list | ||||
| * of children with the replacement data type wrapper. | * of children with the replacement data type wrapper. | ||||
| * | |||||
| * | |||||
| * @param el The task to replace. | * @param el The task to replace. | ||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| * @param o The data type wrapper to replace <code>el</code> with. | * @param o The data type wrapper to replace <code>el</code> with. | ||||
| @@ -367,7 +367,7 @@ public class Target implements TaskContainer { | |||||
| /** | /** | ||||
| * Replaces all occurrences of the given task in the list | * Replaces all occurrences of the given task in the list | ||||
| * of children with the replacement task. | * of children with the replacement task. | ||||
| * | |||||
| * | |||||
| * @param el The task to replace. | * @param el The task to replace. | ||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| * @param o The task to replace <code>el</code> with. | * @param o The task to replace <code>el</code> with. | ||||
| @@ -381,7 +381,7 @@ public class Target implements TaskContainer { | |||||
| /** | /** | ||||
| * Tests whether or not the "if" condition is satisfied. | * Tests whether or not the "if" condition is satisfied. | ||||
| * | |||||
| * | |||||
| * @return whether or not the "if" condition is satisfied. If no | * @return whether or not the "if" condition is satisfied. If no | ||||
| * condition (or an empty condition) has been set, | * condition (or an empty condition) has been set, | ||||
| * <code>true</code> is returned. | * <code>true</code> is returned. | ||||
| @@ -392,14 +392,14 @@ public class Target implements TaskContainer { | |||||
| if ("".equals(ifCondition)) { | if ("".equals(ifCondition)) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| String test = project.replaceProperties(ifCondition); | String test = project.replaceProperties(ifCondition); | ||||
| return project.getProperty(test) != null; | return project.getProperty(test) != null; | ||||
| } | } | ||||
| /** | /** | ||||
| * Tests whether or not the "unless" condition is satisfied. | * Tests whether or not the "unless" condition is satisfied. | ||||
| * | |||||
| * | |||||
| * @return whether or not the "unless" condition is satisfied. If no | * @return whether or not the "unless" condition is satisfied. If no | ||||
| * condition (or an empty condition) has been set, | * condition (or an empty condition) has been set, | ||||
| * <code>true</code> is returned. | * <code>true</code> is returned. | ||||
| @@ -303,7 +303,7 @@ public abstract class Task extends ProjectComponent { | |||||
| wrapper.reconfigure(getProject()); | wrapper.reconfigure(getProject()); | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Handles a line of output by logging it with the INFO priority. | * 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 | * @param length the amount of data to read | ||||
| * | * | ||||
| * @return the number of bytes read | * @return the number of bytes read | ||||
| * | |||||
| * | |||||
| * @exception IOException if the data cannot be read | * @exception IOException if the data cannot be read | ||||
| * @since Ant 1.6 | * @since Ant 1.6 | ||||
| */ | */ | ||||
| protected int handleInput(byte[] buffer, int offset, int length) | |||||
| protected int handleInput(byte[] buffer, int offset, int length) | |||||
| throws IOException { | throws IOException { | ||||
| return getProject().defaultInput(buffer, offset, length); | return getProject().defaultInput(buffer, offset, length); | ||||
| } | } | ||||
| /** | /** | ||||
| * Handles an error line by logging it with the INFO priority. | * 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? | * 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. | * configured in this case. | ||||
| * | * | ||||
| * @since Ant 1.5 | * @since Ant 1.5 | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * 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. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * 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 | * 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. | * a setProject method. | ||||
| * | * | ||||
| * @author costin@dnt.ro | * @author costin@dnt.ro | ||||
| @@ -67,26 +67,26 @@ public class TaskAdapter extends Task implements TypeAdapter { | |||||
| /** Object to act as a proxy for. */ | /** Object to act as a proxy for. */ | ||||
| private Object proxy; | private Object proxy; | ||||
| /** | /** | ||||
| * Checks whether or not a class is suitable to be adapted by TaskAdapter. | * 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 | * tasks adapted by TaskAdapter. Thus, this method should be called by | ||||
| * Project.checkTaskClass. | * Project.checkTaskClass. | ||||
| * | * | ||||
| * Throws a BuildException and logs as Project.MSG_ERR for | * Throws a BuildException and logs as Project.MSG_ERR for | ||||
| * conditions that will cause the task execution to fail. | * conditions that will cause the task execution to fail. | ||||
| * Logs other suspicious conditions with Project.MSG_WARN. | * Logs other suspicious conditions with Project.MSG_WARN. | ||||
| * | |||||
| * @param taskClass Class to test for suitability. | |||||
| * | |||||
| * @param taskClass Class to test for suitability. | |||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| * @param project Project to log warnings/errors to. | |||||
| * @param project Project to log warnings/errors to. | |||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| * | |||||
| * | |||||
| * @see Project#checkTaskClass(Class) | * @see Project#checkTaskClass(Class) | ||||
| */ | */ | ||||
| public static void checkTaskClass(final Class taskClass, | |||||
| public static void checkTaskClass(final Class taskClass, | |||||
| final Project project) { | final Project project) { | ||||
| // don't have to check for interface, since then | // don't have to check for interface, since then | ||||
| // taskClass would be abstract too. | // 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 | // don't have to check for abstract, since then | ||||
| // taskClass would be abstract too. | // taskClass would be abstract too. | ||||
| if (!Void.TYPE.equals(executeM.getReturnType())) { | 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; | + taskClass; | ||||
| project.log(message, Project.MSG_WARN); | project.log(message, Project.MSG_WARN); | ||||
| } | } | ||||
| @@ -116,10 +116,10 @@ public class TaskAdapter extends Task implements TypeAdapter { | |||||
| public void checkProxyClass(Class proxyClass) { | public void checkProxyClass(Class proxyClass) { | ||||
| checkTaskClass(proxyClass, getProject()); | checkTaskClass(proxyClass, getProject()); | ||||
| } | } | ||||
| /** | /** | ||||
| * Executes the proxied task. | * Executes the proxied task. | ||||
| * | |||||
| * | |||||
| * @exception BuildException if the project could not be set | * @exception BuildException if the project could not be set | ||||
| * or the method could not be executed. | * or the method could not be executed. | ||||
| */ | */ | ||||
| @@ -127,7 +127,7 @@ public class TaskAdapter extends Task implements TypeAdapter { | |||||
| Method setProjectM = null; | Method setProjectM = null; | ||||
| try { | try { | ||||
| Class c = proxy.getClass(); | Class c = proxy.getClass(); | ||||
| setProjectM = | |||||
| setProjectM = | |||||
| c.getMethod("setProject", new Class[] {Project.class}); | c.getMethod("setProject", new Class[] {Project.class}); | ||||
| if (setProjectM != null) { | if (setProjectM != null) { | ||||
| setProjectM.invoke(proxy, new Object[] {getProject()}); | 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 | // ignore this if the class being used as a task does not have | ||||
| // a set project method. | // a set project method. | ||||
| } catch (Exception ex) { | } catch (Exception ex) { | ||||
| log("Error setting project in " + proxy.getClass(), | |||||
| log("Error setting project in " + proxy.getClass(), | |||||
| Project.MSG_ERR); | Project.MSG_ERR); | ||||
| throw new BuildException(ex); | throw new BuildException(ex); | ||||
| } | } | ||||
| @@ -147,13 +147,13 @@ public class TaskAdapter extends Task implements TypeAdapter { | |||||
| Class c = proxy.getClass(); | Class c = proxy.getClass(); | ||||
| executeM = c.getMethod("execute", new Class[0]); | executeM = c.getMethod("execute", new Class[0]); | ||||
| if (executeM == null) { | if (executeM == null) { | ||||
| log("No public execute() in " + proxy.getClass(), | |||||
| log("No public execute() in " + proxy.getClass(), | |||||
| Project.MSG_ERR); | Project.MSG_ERR); | ||||
| throw new BuildException("No public execute() in " | |||||
| throw new BuildException("No public execute() in " | |||||
| + proxy.getClass()); | + proxy.getClass()); | ||||
| } | } | ||||
| executeM.invoke(proxy, null); | executeM.invoke(proxy, null); | ||||
| return; | |||||
| return; | |||||
| } catch (java.lang.reflect.InvocationTargetException ie) { | } catch (java.lang.reflect.InvocationTargetException ie) { | ||||
| log("Error in " + proxy.getClass(), Project.MSG_VERBOSE); | log("Error in " + proxy.getClass(), Project.MSG_VERBOSE); | ||||
| Throwable t = ie.getTargetException(); | Throwable t = ie.getTargetException(); | ||||
| @@ -168,10 +168,10 @@ public class TaskAdapter extends Task implements TypeAdapter { | |||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Sets the target object to proxy for. | * Sets the target object to proxy for. | ||||
| * | |||||
| * | |||||
| * @param o The target object. Must not be <code>null</code>. | * @param o The target object. Must not be <code>null</code>. | ||||
| */ | */ | ||||
| public void setProxy(Object o) { | public void setProxy(Object o) { | ||||
| @@ -180,7 +180,7 @@ public class TaskAdapter extends Task implements TypeAdapter { | |||||
| /** | /** | ||||
| * Returns the target object being proxied. | * Returns the target object being proxied. | ||||
| * | |||||
| * | |||||
| * @return the target proxy object | * @return the target proxy object | ||||
| */ | */ | ||||
| public Object getProxy() { | public Object getProxy() { | ||||
| @@ -75,10 +75,10 @@ public class UnknownElement extends Task { | |||||
| * been redefined since original creation. | * been redefined since original creation. | ||||
| */ | */ | ||||
| private String elementName; | private String elementName; | ||||
| /** | |||||
| /** | |||||
| * Holds the namespace of the element. | * Holds the namespace of the element. | ||||
| */ | |||||
| */ | |||||
| private String namespace; | private String namespace; | ||||
| /** | /** | ||||
| @@ -113,18 +113,18 @@ public class UnknownElement extends Task { | |||||
| } | } | ||||
| /** Return the namespace of the XML element associated with this component. | /** Return the namespace of the XML element associated with this component. | ||||
| * | |||||
| * | |||||
| * @return Namespace URI used in the xmlns declaration. | * @return Namespace URI used in the xmlns declaration. | ||||
| */ | |||||
| */ | |||||
| public String getNamespace() { | public String getNamespace() { | ||||
| return namespace; | return namespace; | ||||
| } | } | ||||
| /** Set the namespace of the XML element associated with this component. | /** Set the namespace of the XML element associated with this component. | ||||
| * This method is typically called by the XML processor. | * This method is typically called by the XML processor. | ||||
| * | |||||
| * | |||||
| * @param namespace URI used in the xmlns declaration. | * @param namespace URI used in the xmlns declaration. | ||||
| */ | |||||
| */ | |||||
| public void setNamespace(String namespace) { | public void setNamespace(String namespace) { | ||||
| this.namespace = namespace; | this.namespace = namespace; | ||||
| } | } | ||||
| @@ -163,7 +163,7 @@ public class UnknownElement extends Task { | |||||
| */ | */ | ||||
| public void configure(Object realObject) { | public void configure(Object realObject) { | ||||
| realThing = realObject; | realThing = realObject; | ||||
| getWrapper().setProxy(realThing); | getWrapper().setProxy(realThing); | ||||
| Task task = null; | Task task = null; | ||||
| if (realThing instanceof Task) { | 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 | // configure attributes of the object and it's children. If it is | ||||
| // a task container, defer the configuration till the task container | // a task container, defer the configuration till the task container | ||||
| // attempts to use the task | // attempts to use the task | ||||
| if (task != null) { | if (task != null) { | ||||
| task.maybeConfigure(); | task.maybeConfigure(); | ||||
| } else { | } else { | ||||
| @@ -204,17 +204,17 @@ public class UnknownElement extends Task { | |||||
| /** | /** | ||||
| * @see Task#handleInput(byte[], int, int) | * @see Task#handleInput(byte[], int, int) | ||||
| * | |||||
| * | |||||
| * @since Ant 1.6 | * @since Ant 1.6 | ||||
| */ | */ | ||||
| protected int handleInput(byte[] buffer, int offset, int length) | |||||
| protected int handleInput(byte[] buffer, int offset, int length) | |||||
| throws IOException { | throws IOException { | ||||
| if (realThing instanceof Task) { | if (realThing instanceof Task) { | ||||
| return ((Task) realThing).handleInput(buffer, offset, length); | return ((Task) realThing).handleInput(buffer, offset, length); | ||||
| } else { | } else { | ||||
| return super.handleInput(buffer, offset, length); | return super.handleInput(buffer, offset, length); | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Handles output sent to System.out by this task or its real task. | * 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); | super.handleErrorOutput(line); | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Executes the real object if it's a task. If it's not a task | * 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. | * (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++) { | for (int i = 0; it.hasNext(); i++) { | ||||
| RuntimeConfigurable childWrapper = parentWrapper.getChild(i); | RuntimeConfigurable childWrapper = parentWrapper.getChild(i); | ||||
| UnknownElement child = (UnknownElement) it.next(); | UnknownElement child = (UnknownElement) it.next(); | ||||
| // backwards compatibility - element names of nested | // backwards compatibility - element names of nested | ||||
| // elements have been all lower-case in Ant, except for | // elements have been all lower-case in Ant, except for | ||||
| // TaskContainers | // TaskContainers | ||||
| if (!handleChild(ih, parent, child, | |||||
| child.getTag().toLowerCase(Locale.US), | |||||
| if (!handleChild(ih, parent, child, | |||||
| child.getTag().toLowerCase(Locale.US), | |||||
| childWrapper)) { | childWrapper)) { | ||||
| if (!(parent instanceof TaskContainer)) { | if (!(parent instanceof TaskContainer)) { | ||||
| ih.throwNotSupported(getProject(), parent, | |||||
| ih.throwNotSupported(getProject(), parent, | |||||
| child.getTag()); | child.getTag()); | ||||
| } else { | } else { | ||||
| // a task container - anything could happen - just add the | |||||
| // a task container - anything could happen - just add the | |||||
| // child to the container | // child to the container | ||||
| TaskContainer container = (TaskContainer) parent; | TaskContainer container = (TaskContainer) parent; | ||||
| container.addTask(child); | container.addTask(child); | ||||
| @@ -466,8 +466,8 @@ public class UnknownElement extends Task { | |||||
| Object parent, UnknownElement child, | Object parent, UnknownElement child, | ||||
| String childTag, | String childTag, | ||||
| RuntimeConfigurable childWrapper) { | RuntimeConfigurable childWrapper) { | ||||
| if (ih.supportsNestedElement(childTag)) { | |||||
| Object realChild | |||||
| if (ih.supportsNestedElement(childTag)) { | |||||
| Object realChild | |||||
| = ih.createElement(getProject(), parent, childTag); | = ih.createElement(getProject(), parent, childTag); | ||||
| childWrapper.setProxy(realChild); | childWrapper.setProxy(realChild); | ||||
| if (realChild instanceof Task) { | if (realChild instanceof Task) { | ||||
| @@ -289,7 +289,7 @@ public class XmlLogger implements BuildLogger { | |||||
| TimedElement poppedStack = (TimedElement) threadStack.pop(); | TimedElement poppedStack = (TimedElement) threadStack.pop(); | ||||
| if (poppedStack != targetElement) { | if (poppedStack != targetElement) { | ||||
| throw new RuntimeException("Mismatch - popped element = " | throw new RuntimeException("Mismatch - popped element = " | ||||
| + poppedStack.element | |||||
| + poppedStack.element | |||||
| + " finished target element = " | + " finished target element = " | ||||
| + targetElement.element); | + targetElement.element); | ||||
| } | } | ||||
| @@ -480,7 +480,7 @@ public class XmlLogger implements BuildLogger { | |||||
| /** | /** | ||||
| * Ignore emacs mode, as it has no meaning in XML format | * 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 | * output | ||||
| */ | */ | ||||
| public void setEmacsMode(boolean emacsMode) { | public void setEmacsMode(boolean emacsMode) { | ||||
| @@ -95,7 +95,7 @@ public abstract class BaseFilterReader | |||||
| * | * | ||||
| * @param in A Reader object providing the underlying stream. | * @param in A Reader object providing the underlying stream. | ||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| * | |||||
| * | |||||
| */ | */ | ||||
| public BaseFilterReader(final Reader in) { | public BaseFilterReader(final Reader in) { | ||||
| super(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 | * until some input is available, an I/O error occurs, or the end of the | ||||
| * stream is reached. | * stream is reached. | ||||
| * | * | ||||
| * @param cbuf Destination buffer to write characters to. | |||||
| * @param cbuf Destination buffer to write characters to. | |||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| * @param off Offset at which to start storing characters. | * @param off Offset at which to start storing characters. | ||||
| * @param len Maximum number of characters to read. | * @param len Maximum number of characters to read. | ||||
| @@ -143,7 +143,7 @@ public abstract class BaseFilterReader | |||||
| * @exception IllegalArgumentException If <code>n</code> is negative. | * @exception IllegalArgumentException If <code>n</code> is negative. | ||||
| * @exception IOException If an I/O error occurs | * @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 { | throws IOException, IllegalArgumentException { | ||||
| if (n < 0L) { | if (n < 0L) { | ||||
| throw new IllegalArgumentException("skip value is negative"); | throw new IllegalArgumentException("skip value is negative"); | ||||
| @@ -159,7 +159,7 @@ public abstract class BaseFilterReader | |||||
| /** | /** | ||||
| * Sets the initialized status. | * Sets the initialized status. | ||||
| * | |||||
| * | |||||
| * @param initialized Whether or not the filter is initialized. | * @param initialized Whether or not the filter is initialized. | ||||
| */ | */ | ||||
| protected final void setInitialized(final boolean initialized) { | protected final void setInitialized(final boolean initialized) { | ||||
| @@ -168,7 +168,7 @@ public abstract class BaseFilterReader | |||||
| /** | /** | ||||
| * Returns the initialized status. | * Returns the initialized status. | ||||
| * | |||||
| * | |||||
| * @return whether or not the filter is initialized | * @return whether or not the filter is initialized | ||||
| */ | */ | ||||
| protected final boolean getInitialized() { | protected final boolean getInitialized() { | ||||
| @@ -177,8 +177,8 @@ public abstract class BaseFilterReader | |||||
| /** | /** | ||||
| * Sets the project to work with. | * Sets the project to work with. | ||||
| * | |||||
| * @param project The project this filter is part of. | |||||
| * | |||||
| * @param project The project this filter is part of. | |||||
| * Should not be <code>null</code>. | * Should not be <code>null</code>. | ||||
| */ | */ | ||||
| public final void setProject(final Project project) { | public final void setProject(final Project project) { | ||||
| @@ -187,7 +187,7 @@ public abstract class BaseFilterReader | |||||
| /** | /** | ||||
| * Returns the project this filter is part of. | * Returns the project this filter is part of. | ||||
| * | |||||
| * | |||||
| * @return the project this filter is part of | * @return the project this filter is part of | ||||
| */ | */ | ||||
| protected final Project getProject() { | 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). | * Reads a line of text ending with '\n' (or until the end of the stream). | ||||
| * The returned String retains the '\n'. | * The returned String retains the '\n'. | ||||
| * | |||||
| * | |||||
| * @return the line read, or <code>null</code> if the end of the stream | * @return the line read, or <code>null</code> if the end of the stream | ||||
| * has already been reached | * has already been reached | ||||
| * | |||||
| * @exception IOException if the underlying reader throws one during | |||||
| * | |||||
| * @exception IOException if the underlying reader throws one during | |||||
| * reading | * reading | ||||
| */ | */ | ||||
| protected final String readLine() throws IOException { | protected final String readLine() throws IOException { | ||||
| int ch = in.read(); | int ch = in.read(); | ||||
| if (ch == -1) { | if (ch == -1) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| StringBuffer line = new StringBuffer(); | StringBuffer line = new StringBuffer(); | ||||
| while (ch != -1) { | while (ch != -1) { | ||||
| line.append ((char) ch); | line.append ((char) ch); | ||||
| if (ch == '\n') { | if (ch == '\n') { | ||||
| @@ -225,10 +225,10 @@ public abstract class BaseFilterReader | |||||
| /** | /** | ||||
| * Reads to the end of the stream, returning the contents as a String. | * Reads to the end of the stream, returning the contents as a String. | ||||
| * | |||||
| * | |||||
| * @return the remaining contents of the reader, 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 | * reading | ||||
| */ | */ | ||||
| protected final String readFully() throws IOException { | protected final String readFully() throws IOException { | ||||
| @@ -70,7 +70,7 @@ public abstract class BaseParamFilterReader | |||||
| /** | /** | ||||
| * Constructor for "dummy" instances. | * Constructor for "dummy" instances. | ||||
| * | |||||
| * | |||||
| * @see BaseFilterReader#BaseFilterReader() | * @see BaseFilterReader#BaseFilterReader() | ||||
| */ | */ | ||||
| public BaseParamFilterReader() { | public BaseParamFilterReader() { | ||||
| @@ -90,7 +90,7 @@ public abstract class BaseParamFilterReader | |||||
| /** | /** | ||||
| * Sets the parameters used by this filter, and sets | * Sets the parameters used by this filter, and sets | ||||
| * the filter to an uninitialized status. | * the filter to an uninitialized status. | ||||
| * | |||||
| * | |||||
| * @param parameters The parameters to be used by this filter. | * @param parameters The parameters to be used by this filter. | ||||
| * Should not be <code>null</code>. | * Should not be <code>null</code>. | ||||
| */ | */ | ||||
| @@ -101,7 +101,7 @@ public abstract class BaseParamFilterReader | |||||
| /** | /** | ||||
| * Returns the parameters to be used by this filter. | * Returns the parameters to be used by this filter. | ||||
| * | |||||
| * | |||||
| * @return the parameters to be used by this filter | * @return the parameters to be used by this filter | ||||
| */ | */ | ||||
| protected final Parameter[] getParameters() { | protected final Parameter[] getParameters() { | ||||
| @@ -64,11 +64,11 @@ public interface ChainableReader { | |||||
| /** | /** | ||||
| * Returns a reader with the same configuration as this one, | * Returns a reader with the same configuration as this one, | ||||
| * but filtering input from the specified reader. | * but filtering input from the specified reader. | ||||
| * | |||||
| * | |||||
| * @param rdr the reader which the returned reader should be filtering | * @param rdr the reader which the returned reader should be filtering | ||||
| * | |||||
| * | |||||
| * @return a reader with the same configuration as this one, but | * @return a reader with the same configuration as this one, but | ||||
| * filtering input from the specified reader | * filtering input from the specified reader | ||||
| */ | */ | ||||
| public Reader chain(Reader rdr); | |||||
| Reader chain(Reader rdr); | |||||
| } | } | ||||
| @@ -76,7 +76,8 @@ import java.lang.reflect.Method; | |||||
| * Example:<br> | * Example:<br> | ||||
| * <pre><classconstants/></pre> | * <pre><classconstants/></pre> | ||||
| * Or: | * Or: | ||||
| * <pre><filterreader classname="org.apache.tools.ant.filters.ClassConstants"/></pre> | |||||
| * <pre><filterreader | |||||
| * classname="org.apache.tools.ant.filters.ClassConstants"/></pre> | |||||
| * @author Magesh Umasankar | * @author Magesh Umasankar | ||||
| */ | */ | ||||
| public final class ClassConstants | public final class ClassConstants | ||||
| @@ -91,7 +92,7 @@ public final class ClassConstants | |||||
| /** | /** | ||||
| * Constructor for "dummy" instances. | * Constructor for "dummy" instances. | ||||
| * | |||||
| * | |||||
| * @see BaseFilterReader#BaseFilterReader() | * @see BaseFilterReader#BaseFilterReader() | ||||
| */ | */ | ||||
| public ClassConstants() { | public ClassConstants() { | ||||
| @@ -100,7 +101,7 @@ public final class ClassConstants | |||||
| /** | /** | ||||
| * Creates a new filtered reader. The contents of the passed-in reader | * 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. | * list of constants. | ||||
| * | * | ||||
| * @param in A Reader object providing the underlying stream. | * @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. | * Reads and assembles the constants declared in a class file. | ||||
| * | |||||
| * | |||||
| * @return the next character in the list of constants, or -1 | * @return the next character in the list of constants, or -1 | ||||
| * if the end of the resulting stream has been reached | * if the end of the resulting stream has been reached | ||||
| * | |||||
| * | |||||
| * @exception IOException if the underlying stream throws an IOException | * @exception IOException if the underlying stream throws an IOException | ||||
| * during reading, or if the constants for the specified class cannot | * during reading, or if the constants for the specified class cannot | ||||
| * be read (for example due to the class not being found). | * be read (for example due to the class not being found). | ||||
| @@ -144,7 +145,7 @@ public final class ClassConstants | |||||
| final Class javaClassHelper = | final Class javaClassHelper = | ||||
| Class.forName(JAVA_CLASS_HELPER); | Class.forName(JAVA_CLASS_HELPER); | ||||
| if (javaClassHelper != null) { | if (javaClassHelper != null) { | ||||
| final Class params[] = { | |||||
| final Class[] params = { | |||||
| byte[].class | byte[].class | ||||
| }; | }; | ||||
| final Method getConstants = | final Method getConstants = | ||||
| @@ -180,10 +181,10 @@ public final class ClassConstants | |||||
| /** | /** | ||||
| * Creates a new ClassConstants using the passed in | * Creates a new ClassConstants using the passed in | ||||
| * Reader for instantiation. | * Reader for instantiation. | ||||
| * | |||||
| * | |||||
| * @param rdr A Reader object providing the underlying stream. | * @param rdr A Reader object providing the underlying stream. | ||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| * | |||||
| * | |||||
| * @return a new filter based on this configuration, but filtering | * @return a new filter based on this configuration, but filtering | ||||
| * the specified reader | * the specified reader | ||||
| */ | */ | ||||
| @@ -66,7 +66,7 @@ import org.apache.tools.ant.types.Parameter; | |||||
| * | * | ||||
| * Or: | * Or: | ||||
| * | * | ||||
| * <pre><filterreader | |||||
| * <pre><filterreader | |||||
| classname="org.apache.tools.ant.filters.EscapeUnicode"/> | classname="org.apache.tools.ant.filters.EscapeUnicode"/> | ||||
| * </pre> | * </pre> | ||||
| * | * | ||||
| @@ -161,11 +161,6 @@ public class EscapeUnicode | |||||
| * Parses the parameters (currently unused) | * Parses the parameters (currently unused) | ||||
| */ | */ | ||||
| private final void initialize() { | private final void initialize() { | ||||
| Parameter[] params = getParameters(); | |||||
| if (params != null) { | |||||
| for (int i = 0; i < params.length; i++) { | |||||
| } | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -63,8 +63,9 @@ import org.apache.tools.ant.Project; | |||||
| * Example:<br> | * Example:<br> | ||||
| * <pre><expandproperties/></pre> | * <pre><expandproperties/></pre> | ||||
| * Or: | * Or: | ||||
| * <pre><filterreader classname="org.apache.tools.ant.filters.ExpandProperties"/></pre> | |||||
| * | |||||
| * <pre><filterreader | |||||
| * classname="org.apache.tools.ant.filters.ExpandProperties"/></pre> | |||||
| * | |||||
| * @author Magesh Umasankar | * @author Magesh Umasankar | ||||
| */ | */ | ||||
| public final class ExpandProperties | public final class ExpandProperties | ||||
| @@ -75,7 +76,7 @@ public final class ExpandProperties | |||||
| /** | /** | ||||
| * Constructor for "dummy" instances. | * Constructor for "dummy" instances. | ||||
| * | |||||
| * | |||||
| * @see BaseFilterReader#BaseFilterReader() | * @see BaseFilterReader#BaseFilterReader() | ||||
| */ | */ | ||||
| public ExpandProperties() { | public ExpandProperties() { | ||||
| @@ -97,12 +98,12 @@ public final class ExpandProperties | |||||
| * stream is first read in fully, and the Ant properties are expanded. | * 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 | * The results of this expansion are then queued so they can be read | ||||
| * character-by-character. | * character-by-character. | ||||
| * | |||||
| * | |||||
| * @return the next character in the resulting stream, or -1 | * @return the next character in the resulting stream, or -1 | ||||
| * if the end of the resulting stream has been reached | * if the end of the resulting stream has been reached | ||||
| * | |||||
| * | |||||
| * @exception IOException if the underlying stream throws an IOException | * @exception IOException if the underlying stream throws an IOException | ||||
| * during reading | |||||
| * during reading | |||||
| */ | */ | ||||
| public final int read() throws IOException { | public final int read() throws IOException { | ||||
| @@ -134,10 +135,10 @@ public final class ExpandProperties | |||||
| /** | /** | ||||
| * Creates a new ExpandProperties filter using the passed in | * Creates a new ExpandProperties filter using the passed in | ||||
| * Reader for instantiation. | * Reader for instantiation. | ||||
| * | |||||
| * | |||||
| * @param rdr A Reader object providing the underlying stream. | * @param rdr A Reader object providing the underlying stream. | ||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| * | |||||
| * | |||||
| * @return a new filter based on this configuration, but filtering | * @return a new filter based on this configuration, but filtering | ||||
| * the specified reader | * the specified reader | ||||
| */ | */ | ||||
| @@ -82,15 +82,18 @@ public final class HeadFilter | |||||
| /** Number of lines currently read in. */ | /** Number of lines currently read in. */ | ||||
| private long linesRead = 0; | 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. */ | /** 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. */ | /** Number of lines to be skipped. */ | ||||
| private long skip = 0; | private long skip = 0; | ||||
| /** A line tokenizer */ | /** A line tokenizer */ | ||||
| private TokenFilter.LineTokenizer lineTokenizer = null; | private TokenFilter.LineTokenizer lineTokenizer = null; | ||||
| /** the current line from the input stream */ | /** the current line from the input stream */ | ||||
| private String line = null; | private String line = null; | ||||
| /** the position in the current line */ | /** the position in the current line */ | ||||
| @@ -137,16 +140,18 @@ public final class HeadFilter | |||||
| while (line == null || line.length() == 0) { | while (line == null || line.length() == 0) { | ||||
| line = lineTokenizer.getToken(in); | line = lineTokenizer.getToken(in); | ||||
| if (line == null) | |||||
| if (line == null) { | |||||
| return -1; | return -1; | ||||
| } | |||||
| line = headFilter(line); | line = headFilter(line); | ||||
| linePos = 0; | linePos = 0; | ||||
| } | } | ||||
| int ch = line.charAt(linePos); | int ch = line.charAt(linePos); | ||||
| linePos++; | linePos++; | ||||
| if (linePos == line.length()) | |||||
| if (linePos == line.length()) { | |||||
| line = null; | line = null; | ||||
| } | |||||
| return ch; | return ch; | ||||
| } | } | ||||
| @@ -171,7 +176,7 @@ public final class HeadFilter | |||||
| /** | /** | ||||
| * Sets the number of lines to be skipped in the filtered stream. | * 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) { | public final void setSkip(final long skip) { | ||||
| this.skip = skip; | this.skip = skip; | ||||
| @@ -118,7 +118,7 @@ public final class LineContainsRegExp | |||||
| * Returns the next character in the filtered stream, only including | * Returns the next character in the filtered stream, only including | ||||
| * lines from the original stream which match all of the specified | * lines from the original stream which match all of the specified | ||||
| * regular expressions. | * regular expressions. | ||||
| * | |||||
| * | |||||
| * @return the next character in the resulting stream, or -1 | * @return the next character in the resulting stream, or -1 | ||||
| * if the end of the resulting stream has been reached | * if the end of the resulting stream has been reached | ||||
| * | * | ||||
| @@ -174,8 +174,8 @@ public final class LineContainsRegExp | |||||
| /** | /** | ||||
| * Adds a <code>regexp</code> element. | * Adds a <code>regexp</code> element. | ||||
| * | |||||
| * @param regExp The <code>regexp</code> element to add. | |||||
| * | |||||
| * @param regExp The <code>regexp</code> element to add. | |||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| */ | */ | ||||
| public final void addConfiguredRegexp(final RegularExpression regExp) { | 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. | * filter. | ||||
| * | |||||
| * @param regexps A vector of regular expressions which must be contained | |||||
| * within a line in order for it to match in this filter. Must not be | |||||
| * | |||||
| * @param regexps A vector of regular expressions which must be contained | |||||
| * within a line in order for it to match in this filter. Must not be | |||||
| * <code>null</code>. | * <code>null</code>. | ||||
| */ | */ | ||||
| private void setRegexps(final Vector regexps) { | 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. | * 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. | * the returned object are mirrored in the filter. | ||||
| */ | */ | ||||
| private final Vector getRegexps() { | private final Vector getRegexps() { | ||||
| @@ -212,10 +212,10 @@ public final class LineContainsRegExp | |||||
| /** | /** | ||||
| * Creates a new LineContainsRegExp using the passed in | * Creates a new LineContainsRegExp using the passed in | ||||
| * Reader for instantiation. | * Reader for instantiation. | ||||
| * | |||||
| * | |||||
| * @param rdr A Reader object providing the underlying stream. | * @param rdr A Reader object providing the underlying stream. | ||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| * | |||||
| * | |||||
| * @return a new filter based on this configuration, but filtering | * @return a new filter based on this configuration, but filtering | ||||
| * the specified reader | * the specified reader | ||||
| */ | */ | ||||
| @@ -85,7 +85,7 @@ public final class PrefixLines | |||||
| /** | /** | ||||
| * Constructor for "dummy" instances. | * Constructor for "dummy" instances. | ||||
| * | |||||
| * | |||||
| * @see BaseFilterReader#BaseFilterReader() | * @see BaseFilterReader#BaseFilterReader() | ||||
| */ | */ | ||||
| public PrefixLines() { | public PrefixLines() { | ||||
| @@ -107,12 +107,12 @@ public final class PrefixLines | |||||
| * from the original input, and the prefix added. The resulting | * from the original input, and the prefix added. The resulting | ||||
| * line is then used until it ends, at which point the next original line | * line is then used until it ends, at which point the next original line | ||||
| * is read, etc. | * is read, etc. | ||||
| * | |||||
| * | |||||
| * @return the next character in the resulting stream, or -1 | * @return the next character in the resulting stream, or -1 | ||||
| * if the end of the resulting stream has been reached | * if the end of the resulting stream has been reached | ||||
| * | |||||
| * | |||||
| * @exception IOException if the underlying stream throws an IOException | * @exception IOException if the underlying stream throws an IOException | ||||
| * during reading | |||||
| * during reading | |||||
| */ | */ | ||||
| public final int read() throws IOException { | public final int read() throws IOException { | ||||
| if (!getInitialized()) { | if (!getInitialized()) { | ||||
| @@ -148,7 +148,7 @@ public final class PrefixLines | |||||
| /** | /** | ||||
| * Sets the prefix to add at the start of each input line. | * 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. | * @param prefix The prefix to add at the start of each input line. | ||||
| * May be <code>null</code>, in which case no prefix | * May be <code>null</code>, in which case no prefix | ||||
| * is added. | * is added. | ||||
| @@ -159,7 +159,7 @@ public final class PrefixLines | |||||
| /** | /** | ||||
| * Returns the prefix which will be added at the start of each input line. | * 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 | * @return the prefix which will be added at the start of each input line | ||||
| */ | */ | ||||
| private final String getPrefix() { | private final String getPrefix() { | ||||
| @@ -169,10 +169,10 @@ public final class PrefixLines | |||||
| /** | /** | ||||
| * Creates a new PrefixLines filter using the passed in | * Creates a new PrefixLines filter using the passed in | ||||
| * Reader for instantiation. | * Reader for instantiation. | ||||
| * | |||||
| * | |||||
| * @param rdr A Reader object providing the underlying stream. | * @param rdr A Reader object providing the underlying stream. | ||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| * | |||||
| * | |||||
| * @return a new filter based on this configuration, but filtering | * @return a new filter based on this configuration, but filtering | ||||
| * the specified reader | * the specified reader | ||||
| */ | */ | ||||
| @@ -95,10 +95,10 @@ public final class ReplaceTokens | |||||
| /** Index into replacement data */ | /** Index into replacement data */ | ||||
| private int replaceIndex = -1; | private int replaceIndex = -1; | ||||
| /** Index into queue data */ | /** Index into queue data */ | ||||
| private int queueIndex = -1; | private int queueIndex = -1; | ||||
| /** Hashtable to hold the replacee-replacer pairs (String to String). */ | /** Hashtable to hold the replacee-replacer pairs (String to String). */ | ||||
| private Hashtable hash = new Hashtable(); | private Hashtable hash = new Hashtable(); | ||||
| @@ -110,7 +110,7 @@ public final class ReplaceTokens | |||||
| /** | /** | ||||
| * Constructor for "dummy" instances. | * Constructor for "dummy" instances. | ||||
| * | |||||
| * | |||||
| * @see BaseFilterReader#BaseFilterReader() | * @see BaseFilterReader#BaseFilterReader() | ||||
| */ | */ | ||||
| public ReplaceTokens() { | public ReplaceTokens() { | ||||
| @@ -135,19 +135,19 @@ public final class ReplaceTokens | |||||
| } | } | ||||
| return ch; | return ch; | ||||
| } | } | ||||
| return in.read(); | return in.read(); | ||||
| } | } | ||||
| /** | /** | ||||
| * Returns the next character in the filtered stream, replacing tokens | * Returns the next character in the filtered stream, replacing tokens | ||||
| * from the original stream. | * from the original stream. | ||||
| * | |||||
| * | |||||
| * @return the next character in the resulting stream, or -1 | * @return the next character in the resulting stream, or -1 | ||||
| * if the end of the resulting stream has been reached | * if the end of the resulting stream has been reached | ||||
| * | |||||
| * | |||||
| * @exception IOException if the underlying stream throws an IOException | * @exception IOException if the underlying stream throws an IOException | ||||
| * during reading | |||||
| * during reading | |||||
| */ | */ | ||||
| public final int read() throws IOException { | public final int read() throws IOException { | ||||
| if (!getInitialized()) { | if (!getInitialized()) { | ||||
| @@ -162,7 +162,7 @@ public final class ReplaceTokens | |||||
| } | } | ||||
| return ch; | return ch; | ||||
| } | } | ||||
| int ch = getNextChar(); | int ch = getNextChar(); | ||||
| if (ch == beginToken) { | if (ch == beginToken) { | ||||
| @@ -180,14 +180,14 @@ public final class ReplaceTokens | |||||
| if (queuedData == null || queueIndex == -1) { | if (queuedData == null || queueIndex == -1) { | ||||
| queuedData = key.toString(); | queuedData = key.toString(); | ||||
| } else { | } else { | ||||
| queuedData | |||||
| queuedData | |||||
| = key.toString() + queuedData.substring(queueIndex); | = key.toString() + queuedData.substring(queueIndex); | ||||
| } | } | ||||
| queueIndex = 0; | queueIndex = 0; | ||||
| return beginToken; | return beginToken; | ||||
| } else { | } else { | ||||
| key.setLength(key.length() - 1); | key.setLength(key.length() - 1); | ||||
| final String replaceWith = (String) hash.get(key.toString()); | final String replaceWith = (String) hash.get(key.toString()); | ||||
| if (replaceWith != null) { | if (replaceWith != null) { | ||||
| if (replaceWith.length() > 0) { | if (replaceWith.length() > 0) { | ||||
| @@ -212,7 +212,7 @@ public final class ReplaceTokens | |||||
| /** | /** | ||||
| * Sets the "begin token" character. | * Sets the "begin token" character. | ||||
| * | |||||
| * | |||||
| * @param beginToken the character used to denote the beginning of a token | * @param beginToken the character used to denote the beginning of a token | ||||
| */ | */ | ||||
| public final void setBeginToken(final char beginToken) { | public final void setBeginToken(final char beginToken) { | ||||
| @@ -221,7 +221,7 @@ public final class ReplaceTokens | |||||
| /** | /** | ||||
| * Returns the "begin token" character. | * Returns the "begin token" character. | ||||
| * | |||||
| * | |||||
| * @return the character used to denote the beginning of a token | * @return the character used to denote the beginning of a token | ||||
| */ | */ | ||||
| private final char getBeginToken() { | private final char getBeginToken() { | ||||
| @@ -230,7 +230,7 @@ public final class ReplaceTokens | |||||
| /** | /** | ||||
| * Sets the "end token" character. | * Sets the "end token" character. | ||||
| * | |||||
| * | |||||
| * @param endToken the character used to denote the end of a token | * @param endToken the character used to denote the end of a token | ||||
| */ | */ | ||||
| public final void setEndToken(final char endToken) { | public final void setEndToken(final char endToken) { | ||||
| @@ -239,7 +239,7 @@ public final class ReplaceTokens | |||||
| /** | /** | ||||
| * Returns the "end token" character. | * Returns the "end token" character. | ||||
| * | |||||
| * | |||||
| * @return the character used to denote the end of a token | * @return the character used to denote the end of a token | ||||
| */ | */ | ||||
| private final char getEndToken() { | private final char getEndToken() { | ||||
| @@ -248,7 +248,7 @@ public final class ReplaceTokens | |||||
| /** | /** | ||||
| * Adds a token element to the map of tokens to replace. | * Adds a token element to the map of tokens to replace. | ||||
| * | |||||
| * | |||||
| * @param token The token to add to the map of replacements. | * @param token The token to add to the map of replacements. | ||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| */ | */ | ||||
| @@ -258,7 +258,7 @@ public final class ReplaceTokens | |||||
| /** | /** | ||||
| * Sets the map of tokens to replace. | * Sets the map of tokens to replace. | ||||
| * | |||||
| * | |||||
| * @param hash A map (String->String) of token keys to replacement | * @param hash A map (String->String) of token keys to replacement | ||||
| * values. Must not be <code>null</code>. | * values. Must not be <code>null</code>. | ||||
| */ | */ | ||||
| @@ -268,7 +268,7 @@ public final class ReplaceTokens | |||||
| /** | /** | ||||
| * Returns the map of tokens which will be replaced. | * Returns the map of tokens which will be replaced. | ||||
| * | |||||
| * | |||||
| * @return a map (String->String) of token keys to replacement | * @return a map (String->String) of token keys to replacement | ||||
| * values | * values | ||||
| */ | */ | ||||
| @@ -279,10 +279,10 @@ public final class ReplaceTokens | |||||
| /** | /** | ||||
| * Creates a new ReplaceTokens using the passed in | * Creates a new ReplaceTokens using the passed in | ||||
| * Reader for instantiation. | * Reader for instantiation. | ||||
| * | |||||
| * | |||||
| * @param rdr A Reader object providing the underlying stream. | * @param rdr A Reader object providing the underlying stream. | ||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| * | |||||
| * | |||||
| * @return a new filter based on this configuration, but filtering | * @return a new filter based on this configuration, but filtering | ||||
| * the specified reader | * the specified reader | ||||
| */ | */ | ||||
| @@ -309,13 +309,13 @@ public final class ReplaceTokens | |||||
| String value = params[i].getValue(); | String value = params[i].getValue(); | ||||
| if ("begintoken".equals(name)) { | if ("begintoken".equals(name)) { | ||||
| if (value.length() == 0) { | if (value.length() == 0) { | ||||
| throw new BuildException("Begin token cannot " | |||||
| throw new BuildException("Begin token cannot " | |||||
| + "be empty"); | + "be empty"); | ||||
| } | } | ||||
| beginToken = params[i].getValue().charAt(0); | beginToken = params[i].getValue().charAt(0); | ||||
| } else if ("endtoken".equals(name)) { | } else if ("endtoken".equals(name)) { | ||||
| if (value.length() == 0) { | if (value.length() == 0) { | ||||
| throw new BuildException("End token cannot " | |||||
| throw new BuildException("End token cannot " | |||||
| + "be empty"); | + "be empty"); | ||||
| } | } | ||||
| endToken = params[i].getValue().charAt(0); | endToken = params[i].getValue().charAt(0); | ||||
| @@ -343,7 +343,7 @@ public final class ReplaceTokens | |||||
| /** | /** | ||||
| * Sets the token key | * Sets the token key | ||||
| * | |||||
| * | |||||
| * @param key The key for this token. Must not be <code>null</code>. | * @param key The key for this token. Must not be <code>null</code>. | ||||
| */ | */ | ||||
| public final void setKey(String key) { | public final void setKey(String key) { | ||||
| @@ -352,7 +352,7 @@ public final class ReplaceTokens | |||||
| /** | /** | ||||
| * Sets the token value | * Sets the token value | ||||
| * | |||||
| * | |||||
| * @param value The value for this token. Must not be <code>null</code>. | * @param value The value for this token. Must not be <code>null</code>. | ||||
| */ | */ | ||||
| public final void setValue(String value) { | public final void setValue(String value) { | ||||
| @@ -361,7 +361,7 @@ public final class ReplaceTokens | |||||
| /** | /** | ||||
| * Returns the key for this token. | * Returns the key for this token. | ||||
| * | |||||
| * | |||||
| * @return the key for this token | * @return the key for this token | ||||
| */ | */ | ||||
| public final String getKey() { | public final String getKey() { | ||||
| @@ -370,7 +370,7 @@ public final class ReplaceTokens | |||||
| /** | /** | ||||
| * Returns the value for this token. | * Returns the value for this token. | ||||
| * | |||||
| * | |||||
| * @return the value for this token | * @return the value for this token | ||||
| */ | */ | ||||
| public final String getValue() { | public final String getValue() { | ||||
| @@ -59,7 +59,7 @@ import org.apache.tools.ant.types.Parameter; | |||||
| /** | /** | ||||
| * Filter to flatten the stream to a single line. | * Filter to flatten the stream to a single line. | ||||
| * | |||||
| * | |||||
| * Example: | * Example: | ||||
| * | * | ||||
| * <pre><striplinebreaks/></pre> | * <pre><striplinebreaks/></pre> | ||||
| @@ -88,7 +88,7 @@ public final class StripLineBreaks | |||||
| /** | /** | ||||
| * Constructor for "dummy" instances. | * Constructor for "dummy" instances. | ||||
| * | |||||
| * | |||||
| * @see BaseFilterReader#BaseFilterReader() | * @see BaseFilterReader#BaseFilterReader() | ||||
| */ | */ | ||||
| public StripLineBreaks() { | public StripLineBreaks() { | ||||
| @@ -108,12 +108,12 @@ public final class StripLineBreaks | |||||
| /** | /** | ||||
| * Returns the next character in the filtered stream, only including | * Returns the next character in the filtered stream, only including | ||||
| * characters not in the set of line-breaking characters. | * characters not in the set of line-breaking characters. | ||||
| * | |||||
| * | |||||
| * @return the next character in the resulting stream, or -1 | * @return the next character in the resulting stream, or -1 | ||||
| * if the end of the resulting stream has been reached | * if the end of the resulting stream has been reached | ||||
| * | |||||
| * | |||||
| * @exception IOException if the underlying stream throws an IOException | * @exception IOException if the underlying stream throws an IOException | ||||
| * during reading | |||||
| * during reading | |||||
| */ | */ | ||||
| public final int read() throws IOException { | public final int read() throws IOException { | ||||
| if (!getInitialized()) { | if (!getInitialized()) { | ||||
| @@ -134,7 +134,7 @@ public final class StripLineBreaks | |||||
| /** | /** | ||||
| * Sets the line-breaking characters. | * Sets the line-breaking characters. | ||||
| * | |||||
| * | |||||
| * @param lineBreaks A String containing all the characters to be | * @param lineBreaks A String containing all the characters to be | ||||
| * considered as line-breaking. | * considered as line-breaking. | ||||
| */ | */ | ||||
| @@ -144,8 +144,8 @@ public final class StripLineBreaks | |||||
| /** | /** | ||||
| * Returns the line-breaking characters as a String. | * 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 | * line-breaking | ||||
| */ | */ | ||||
| private final String getLineBreaks() { | private final String getLineBreaks() { | ||||
| @@ -155,10 +155,10 @@ public final class StripLineBreaks | |||||
| /** | /** | ||||
| * Creates a new StripLineBreaks using the passed in | * Creates a new StripLineBreaks using the passed in | ||||
| * Reader for instantiation. | * Reader for instantiation. | ||||
| * | |||||
| * | |||||
| * @param rdr A Reader object providing the underlying stream. | * @param rdr A Reader object providing the underlying stream. | ||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| * | |||||
| * | |||||
| * @return a new filter based on this configuration, but filtering | * @return a new filter based on this configuration, but filtering | ||||
| * the specified reader | * the specified reader | ||||
| */ | */ | ||||
| @@ -73,7 +73,7 @@ import org.apache.tools.ant.types.Parameter; | |||||
| * | * | ||||
| * Or: | * Or: | ||||
| * | * | ||||
| * <pre><filterreader | |||||
| * <pre><filterreader | |||||
| * classname="org.apache.tools.ant.filters.StripLineComments"> | * classname="org.apache.tools.ant.filters.StripLineComments"> | ||||
| * <param type="comment" value="#"/> | * <param type="comment" value="#"/> | ||||
| * <param type="comment" value="--"/> | * <param type="comment" value="--"/> | ||||
| @@ -98,7 +98,7 @@ public final class StripLineComments | |||||
| /** | /** | ||||
| * Constructor for "dummy" instances. | * Constructor for "dummy" instances. | ||||
| * | |||||
| * | |||||
| * @see BaseFilterReader#BaseFilterReader() | * @see BaseFilterReader#BaseFilterReader() | ||||
| */ | */ | ||||
| public StripLineComments() { | public StripLineComments() { | ||||
| @@ -117,14 +117,14 @@ public final class StripLineComments | |||||
| /** | /** | ||||
| * Returns the next character in the filtered stream, only including | * 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. | * specified comment prefixes. | ||||
| * | |||||
| * | |||||
| * @return the next character in the resulting stream, or -1 | * @return the next character in the resulting stream, or -1 | ||||
| * if the end of the resulting stream has been reached | * if the end of the resulting stream has been reached | ||||
| * | |||||
| * | |||||
| * @exception IOException if the underlying stream throws an IOException | * @exception IOException if the underlying stream throws an IOException | ||||
| * during reading | |||||
| * during reading | |||||
| */ | */ | ||||
| public final int read() throws IOException { | public final int read() throws IOException { | ||||
| if (!getInitialized()) { | if (!getInitialized()) { | ||||
| @@ -172,7 +172,7 @@ public final class StripLineComments | |||||
| /** | /** | ||||
| * Adds a <code>comment</code> element to the list of prefixes. | * Adds a <code>comment</code> element to the list of prefixes. | ||||
| * | |||||
| * | |||||
| * @param comment The <code>comment</code> element to add to the | * @param comment The <code>comment</code> element to add to the | ||||
| * list of comment prefixes to strip. Must not be <code>null</code>. | * list of comment prefixes to strip. Must not be <code>null</code>. | ||||
| */ | */ | ||||
| @@ -182,7 +182,7 @@ public final class StripLineComments | |||||
| /** | /** | ||||
| * Sets the list of comment prefixes to strip. | * Sets the list of comment prefixes to strip. | ||||
| * | |||||
| * | |||||
| * @param comments A list of strings, each of which is a prefix | * @param comments A list of strings, each of which is a prefix | ||||
| * for a comment line. Must not be <code>null</code>. | * for a comment line. Must not be <code>null</code>. | ||||
| */ | */ | ||||
| @@ -192,7 +192,7 @@ public final class StripLineComments | |||||
| /** | /** | ||||
| * Returns the list of comment prefixes to strip. | * Returns the list of comment prefixes to strip. | ||||
| * | |||||
| * | |||||
| * @return the list of comment prefixes to strip. | * @return the list of comment prefixes to strip. | ||||
| */ | */ | ||||
| private final Vector getComments() { | private final Vector getComments() { | ||||
| @@ -202,10 +202,10 @@ public final class StripLineComments | |||||
| /** | /** | ||||
| * Creates a new StripLineComments using the passed in | * Creates a new StripLineComments using the passed in | ||||
| * Reader for instantiation. | * Reader for instantiation. | ||||
| * | |||||
| * | |||||
| * @param rdr A Reader object providing the underlying stream. | * @param rdr A Reader object providing the underlying stream. | ||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| * | |||||
| * | |||||
| * @return a new filter based on this configuration, but filtering | * @return a new filter based on this configuration, but filtering | ||||
| * the specified reader | * the specified reader | ||||
| */ | */ | ||||
| @@ -240,7 +240,7 @@ public final class StripLineComments | |||||
| /** | /** | ||||
| * Sets the prefix for this type of line comment. | * Sets the prefix for this type of line comment. | ||||
| * | |||||
| * | |||||
| * @param comment The prefix for a line comment of this type. | * @param comment The prefix for a line comment of this type. | ||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| */ | */ | ||||
| @@ -250,7 +250,7 @@ public final class StripLineComments | |||||
| /** | /** | ||||
| * Returns the prefix for this type of line comment. | * Returns the prefix for this type of line comment. | ||||
| * | |||||
| * | |||||
| * @return the prefix for this type of line comment. | * @return the prefix for this type of line comment. | ||||
| */ | */ | ||||
| public final String getValue() { | public final String getValue() { | ||||
| @@ -89,7 +89,7 @@ public final class TabsToSpaces | |||||
| /** | /** | ||||
| * Constructor for "dummy" instances. | * Constructor for "dummy" instances. | ||||
| * | |||||
| * | |||||
| * @see BaseFilterReader#BaseFilterReader() | * @see BaseFilterReader#BaseFilterReader() | ||||
| */ | */ | ||||
| public TabsToSpaces() { | public TabsToSpaces() { | ||||
| @@ -109,12 +109,12 @@ public final class TabsToSpaces | |||||
| /** | /** | ||||
| * Returns the next character in the filtered stream, converting tabs | * Returns the next character in the filtered stream, converting tabs | ||||
| * to the specified number of spaces. | * to the specified number of spaces. | ||||
| * | |||||
| * | |||||
| * @return the next character in the resulting stream, or -1 | * @return the next character in the resulting stream, or -1 | ||||
| * if the end of the resulting stream has been reached | * if the end of the resulting stream has been reached | ||||
| * | |||||
| * | |||||
| * @exception IOException if the underlying stream throws an IOException | * @exception IOException if the underlying stream throws an IOException | ||||
| * during reading | |||||
| * during reading | |||||
| */ | */ | ||||
| public final int read() throws IOException { | public final int read() throws IOException { | ||||
| if (!getInitialized()) { | if (!getInitialized()) { | ||||
| @@ -139,7 +139,7 @@ public final class TabsToSpaces | |||||
| /** | /** | ||||
| * Sets the tab length. | * Sets the tab length. | ||||
| * | |||||
| * | |||||
| * @param tabLength the number of spaces to be used when converting a tab. | * @param tabLength the number of spaces to be used when converting a tab. | ||||
| */ | */ | ||||
| public final void setTablength(final int tabLength) { | public final void setTablength(final int tabLength) { | ||||
| @@ -148,7 +148,7 @@ public final class TabsToSpaces | |||||
| /** | /** | ||||
| * Returns the tab length. | * Returns the tab length. | ||||
| * | |||||
| * | |||||
| * @return the number of spaces used when converting a tab | * @return the number of spaces used when converting a tab | ||||
| */ | */ | ||||
| private final int getTablength() { | private final int getTablength() { | ||||
| @@ -158,10 +158,10 @@ public final class TabsToSpaces | |||||
| /** | /** | ||||
| * Creates a new TabsToSpaces using the passed in | * Creates a new TabsToSpaces using the passed in | ||||
| * Reader for instantiation. | * Reader for instantiation. | ||||
| * | |||||
| * | |||||
| * @param rdr A Reader object providing the underlying stream. | * @param rdr A Reader object providing the underlying stream. | ||||
| * Must not be <code>null</code>. | * Must not be <code>null</code>. | ||||
| * | |||||
| * | |||||
| * @return a new filter based on this configuration, but filtering | * @return a new filter based on this configuration, but filtering | ||||
| * the specified reader | * the specified reader | ||||
| */ | */ | ||||
| @@ -99,14 +99,14 @@ public final class TailFilter | |||||
| /** A line tokenizer */ | /** A line tokenizer */ | ||||
| private TokenFilter.LineTokenizer lineTokenizer = null; | private TokenFilter.LineTokenizer lineTokenizer = null; | ||||
| /** the current line from the input stream */ | /** the current line from the input stream */ | ||||
| private String line = null; | private String line = null; | ||||
| /** the position in the current line */ | /** the position in the current line */ | ||||
| private int linePos = 0; | private int linePos = 0; | ||||
| private LinkedList lineList = new LinkedList(); | private LinkedList lineList = new LinkedList(); | ||||
| /** | /** | ||||
| * Constructor for "dummy" instances. | * Constructor for "dummy" instances. | ||||
| * | * | ||||
| @@ -77,17 +77,17 @@ import org.apache.tools.ant.util.StringUtils; | |||||
| * | * | ||||
| * @author costin@dnt.ro | * @author costin@dnt.ro | ||||
| * @author stefano@apache.org | * @author stefano@apache.org | ||||
| * @author Wolfgang Werner | |||||
| * @author Wolfgang Werner | |||||
| * <a href="mailto:wwerner@picturesafe.de">wwerner@picturesafe.de</a> | * <a href="mailto:wwerner@picturesafe.de">wwerner@picturesafe.de</a> | ||||
| * @author Kevin Ross | |||||
| * @author Kevin Ross | |||||
| * <a href="mailto:kevin.ross@bredex.com">kevin.ross@bredex.com</a> | * <a href="mailto:kevin.ross@bredex.com">kevin.ross@bredex.com</a> | ||||
| * | * | ||||
| * @since Ant 1.5 | * @since Ant 1.5 | ||||
| */ | */ | ||||
| public abstract class AbstractCvsTask extends Task { | public abstract class AbstractCvsTask extends Task { | ||||
| /** | |||||
| /** | |||||
| * Default compression level to use, if compression is enabled via | * Default compression level to use, if compression is enabled via | ||||
| * setCompression( true ). | |||||
| * setCompression( true ). | |||||
| */ | */ | ||||
| public static final int DEFAULT_COMPRESSION_LEVEL = 3; | public static final int DEFAULT_COMPRESSION_LEVEL = 3; | ||||
| @@ -189,7 +189,7 @@ public abstract class AbstractCvsTask extends Task { | |||||
| protected ExecuteStreamHandler getExecuteStreamHandler() { | protected ExecuteStreamHandler getExecuteStreamHandler() { | ||||
| if (this.executeStreamHandler == null) { | if (this.executeStreamHandler == null) { | ||||
| setExecuteStreamHandler(new PumpStreamHandler(getOutputStream(), | |||||
| setExecuteStreamHandler(new PumpStreamHandler(getOutputStream(), | |||||
| getErrorStream())); | getErrorStream())); | ||||
| } | } | ||||
| @@ -211,7 +211,7 @@ public abstract class AbstractCvsTask extends Task { | |||||
| setOutputStream(new PrintStream( | setOutputStream(new PrintStream( | ||||
| new BufferedOutputStream( | new BufferedOutputStream( | ||||
| new FileOutputStream(output | new FileOutputStream(output | ||||
| .getPath(), | |||||
| .getPath(), | |||||
| append)))); | append)))); | ||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| throw new BuildException(e, getLocation()); | throw new BuildException(e, getLocation()); | ||||
| @@ -280,7 +280,7 @@ public abstract class AbstractCvsTask extends Task { | |||||
| File defaultPassFile = new File( | File defaultPassFile = new File( | ||||
| System.getProperty("cygwin.user.home", | System.getProperty("cygwin.user.home", | ||||
| System.getProperty("user.home")) | |||||
| System.getProperty("user.home")) | |||||
| + File.separatorChar + ".cvspass"); | + File.separatorChar + ".cvspass"); | ||||
| if(defaultPassFile.exists()) { | if(defaultPassFile.exists()) { | ||||
| @@ -294,7 +294,7 @@ public abstract class AbstractCvsTask extends Task { | |||||
| var.setKey("CVS_PASSFILE"); | var.setKey("CVS_PASSFILE"); | ||||
| var.setValue(String.valueOf(passFile)); | var.setValue(String.valueOf(passFile)); | ||||
| env.addVariable(var); | env.addVariable(var); | ||||
| log("Using cvs passfile: " + String.valueOf(passFile), | |||||
| log("Using cvs passfile: " + String.valueOf(passFile), | |||||
| Project.MSG_INFO); | Project.MSG_INFO); | ||||
| } else if (!passFile.canRead()) { | } else if (!passFile.canRead()) { | ||||
| log("cvs passfile: " + String.valueOf(passFile) | 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)*/ | /*Throw an exception if cvs exited with error. (Iulian)*/ | ||||
| if (failOnError && retCode != 0) { | if (failOnError && retCode != 0) { | ||||
| throw new BuildException("cvs exited with error code " | throw new BuildException("cvs exited with error code " | ||||
| + retCode | |||||
| + retCode | |||||
| + StringUtils.LINE_SEP | + StringUtils.LINE_SEP | ||||
| + "Command line was [" | + "Command line was [" | ||||
| + actualCommandLine + "]", getLocation()); | + actualCommandLine + "]", getLocation()); | ||||
| @@ -413,7 +413,7 @@ public abstract class AbstractCvsTask extends Task { | |||||
| private String executeToString(Execute execute){ | private String executeToString(Execute execute){ | ||||
| StringBuffer stringBuffer = | |||||
| StringBuffer stringBuffer = | |||||
| new StringBuffer(Commandline.describeCommand(execute | new StringBuffer(Commandline.describeCommand(execute | ||||
| .getCommandline())); | .getCommandline())); | ||||
| @@ -674,10 +674,10 @@ public abstract class AbstractCvsTask extends Task { | |||||
| * Configures and adds the given Commandline. | * Configures and adds the given Commandline. | ||||
| * @param insertAtStart If true, c is | * @param insertAtStart If true, c is | ||||
| */ | */ | ||||
| public void addConfiguredCommandline(Commandline c, | |||||
| public void addConfiguredCommandline(Commandline c, | |||||
| boolean insertAtStart) { | boolean insertAtStart) { | ||||
| if (c == null) { | if (c == null) { | ||||
| return; | |||||
| return; | |||||
| } | } | ||||
| this.configureCommandline(c); | this.configureCommandline(c); | ||||
| if (insertAtStart) { | if (insertAtStart) { | ||||
| @@ -702,7 +702,7 @@ public abstract class AbstractCvsTask extends Task { | |||||
| * level, AbstractCvsTask.DEFAULT_COMPRESSION_LEVEL. | * level, AbstractCvsTask.DEFAULT_COMPRESSION_LEVEL. | ||||
| */ | */ | ||||
| public void setCompression(boolean usecomp) { | public void setCompression(boolean usecomp) { | ||||
| setCompressionLevel(usecomp ? | |||||
| setCompressionLevel(usecomp ? | |||||
| AbstractCvsTask.DEFAULT_COMPRESSION_LEVEL : 0); | AbstractCvsTask.DEFAULT_COMPRESSION_LEVEL : 0); | ||||
| } | } | ||||
| @@ -273,10 +273,10 @@ public class Ant extends Task { | |||||
| /** | /** | ||||
| * @see Task#handleInput(byte[], int, int) | * @see Task#handleInput(byte[], int, int) | ||||
| * | |||||
| * | |||||
| * @since Ant 1.6 | * @since Ant 1.6 | ||||
| */ | */ | ||||
| public int handleInput(byte[] buffer, int offset, int length) | |||||
| public int handleInput(byte[] buffer, int offset, int length) | |||||
| throws IOException { | throws IOException { | ||||
| if (newProject != null) { | if (newProject != null) { | ||||
| return newProject.demuxInput(buffer, offset, length); | return newProject.demuxInput(buffer, offset, length); | ||||
| @@ -284,7 +284,7 @@ public class Ant extends Task { | |||||
| return super.handleInput(buffer, offset, length); | return super.handleInput(buffer, offset, length); | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Pass output sent to System.out to the new project. | * Pass output sent to System.out to the new project. | ||||
| * | * | ||||
| @@ -371,7 +371,7 @@ public class Ant extends Task { | |||||
| target = newProject.getDefaultTarget(); | 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)? | // the build file if this is a top level task)? | ||||
| if (newProject.getBaseDir().equals(getProject().getBaseDir()) && | if (newProject.getBaseDir().equals(getProject().getBaseDir()) && | ||||
| newProject.getProperty("ant.file").equals(getProject().getProperty("ant.file")) | newProject.getProperty("ant.file").equals(getProject().getProperty("ant.file")) | ||||
| @@ -432,7 +432,7 @@ public class Ant extends Task { | |||||
| * requested. | * requested. | ||||
| */ | */ | ||||
| private void addReferences() throws BuildException { | private void addReferences() throws BuildException { | ||||
| Hashtable thisReferences | |||||
| Hashtable thisReferences | |||||
| = (Hashtable) getProject().getReferences().clone(); | = (Hashtable) getProject().getReferences().clone(); | ||||
| Hashtable newReferences = newProject.getReferences(); | Hashtable newReferences = newProject.getReferences(); | ||||
| Enumeration e; | Enumeration e; | ||||
| @@ -484,8 +484,8 @@ public class Ant extends Task { | |||||
| private void copyReference(String oldKey, String newKey) { | private void copyReference(String oldKey, String newKey) { | ||||
| Object orig = getProject().getReference(oldKey); | Object orig = getProject().getReference(oldKey); | ||||
| if (orig == null) { | 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); | Project.MSG_WARN); | ||||
| return; | return; | ||||
| } | } | ||||
| @@ -579,7 +579,7 @@ public class Ant extends Task { | |||||
| if (s.equals("")) { | if (s.equals("")) { | ||||
| throw new BuildException("target attribute must not be empty"); | throw new BuildException("target attribute must not be empty"); | ||||
| } | } | ||||
| this.target = s; | this.target = s; | ||||
| } | } | ||||
| @@ -130,7 +130,7 @@ public class Basename extends Task { | |||||
| // char preceding the suffix is a '.', we assume the user | // char preceding the suffix is a '.', we assume the user | ||||
| // wants to remove the '.' as well (see docs) | // wants to remove the '.' as well (see docs) | ||||
| int pos = value.length() - suffix.length(); | int pos = value.length() - suffix.length(); | ||||
| if (pos > 0 && suffix.charAt(0) != '.' | |||||
| if (pos > 0 && suffix.charAt(0) != '.' | |||||
| && value.charAt(pos - 1) == '.') { | && value.charAt(pos - 1) == '.') { | ||||
| pos--; | pos--; | ||||
| } | } | ||||
| @@ -78,7 +78,7 @@ import java.io.IOException; | |||||
| * defined in the project itself. | * defined in the project itself. | ||||
| * | * | ||||
| * | * | ||||
| * @author Stefan Bodewig | |||||
| * @author Stefan Bodewig | |||||
| * | * | ||||
| * @since Ant 1.2 | * @since Ant 1.2 | ||||
| * | * | ||||
| @@ -131,12 +131,12 @@ public class CallTarget extends Task { | |||||
| if (callee == null) { | if (callee == null) { | ||||
| init(); | init(); | ||||
| } | } | ||||
| if (subTarget == null) { | if (subTarget == null) { | ||||
| throw new BuildException("Attribute target is required.", | |||||
| throw new BuildException("Attribute target is required.", | |||||
| getLocation()); | getLocation()); | ||||
| } | } | ||||
| callee.setAntfile(getProject().getProperty("ant.file")); | callee.setAntfile(getProject().getProperty("ant.file")); | ||||
| callee.setTarget(subTarget); | callee.setTarget(subTarget); | ||||
| callee.setInheritAll(inheritAll); | callee.setInheritAll(inheritAll); | ||||
| @@ -197,13 +197,13 @@ public class CallTarget extends Task { | |||||
| super.handleOutput(line); | super.handleOutput(line); | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * @see Task#handleInput(byte[], int, int) | * @see Task#handleInput(byte[], int, int) | ||||
| * | |||||
| * | |||||
| * @since Ant 1.6 | * @since Ant 1.6 | ||||
| */ | */ | ||||
| public int handleInput(byte[] buffer, int offset, int length) | |||||
| public int handleInput(byte[] buffer, int offset, int length) | |||||
| throws IOException { | throws IOException { | ||||
| if (callee != null) { | if (callee != null) { | ||||
| return callee.handleInput(buffer, offset, length); | return callee.handleInput(buffer, offset, length); | ||||
| @@ -224,7 +224,7 @@ public class CallTarget extends Task { | |||||
| super.handleFlush(line); | super.handleFlush(line); | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Pass output sent to System.err to the new project. | * Pass output sent to System.err to the new project. | ||||
| * | * | ||||
| @@ -237,7 +237,7 @@ public class CallTarget extends Task { | |||||
| super.handleErrorOutput(line); | super.handleErrorOutput(line); | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Pass output sent to System.err to the new project. | * Pass output sent to System.err to the new project. | ||||
| * | * | ||||
| @@ -111,7 +111,7 @@ public class Concat extends Task { | |||||
| private File destinationFile = null; | 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. | * exists. | ||||
| * Defaults to <code>false</code>. | * Defaults to <code>false</code>. | ||||
| */ | */ | ||||
| @@ -311,11 +311,11 @@ public class Concat extends Task { | |||||
| public void setWriter(Writer outputWriter) { | public void setWriter(Writer outputWriter) { | ||||
| this.outputWriter = outputWriter; | this.outputWriter = outputWriter; | ||||
| } | } | ||||
| /** | /** | ||||
| * This method performs the concatenation. | * This method performs the concatenation. | ||||
| */ | */ | ||||
| public void execute() | |||||
| public void execute() | |||||
| throws BuildException { | throws BuildException { | ||||
| // treat empty nested text as no text | // treat empty nested text as no text | ||||
| @@ -325,12 +325,12 @@ public class Concat extends Task { | |||||
| throw new BuildException( | throw new BuildException( | ||||
| "Cannot specify both a destination file and an output writer"); | "Cannot specify both a destination file and an output writer"); | ||||
| } | } | ||||
| // Sanity check our inputs. | // Sanity check our inputs. | ||||
| if (sources.size() == 0 && textBuffer == null) { | if (sources.size() == 0 && textBuffer == null) { | ||||
| // Nothing to concatenate! | // 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."); | "some text."); | ||||
| } | } | ||||
| @@ -338,7 +338,7 @@ public class Concat extends Task { | |||||
| // using GNU 'cat' with file arguments -- stdin is simply | // using GNU 'cat' with file arguments -- stdin is simply | ||||
| // ignored. | // ignored. | ||||
| if (sources.size() > 0 && textBuffer != null) { | if (sources.size() > 0 && textBuffer != null) { | ||||
| throw new BuildException("Cannot include inline text " + | |||||
| throw new BuildException("Cannot include inline text " + | |||||
| "when using filesets."); | "when using filesets."); | ||||
| } | } | ||||
| @@ -382,9 +382,9 @@ public class Concat extends Task { | |||||
| // Do nothing if all the sources are not present | // Do nothing if all the sources are not present | ||||
| // And textBuffer is null | // And textBuffer is null | ||||
| if (textBuffer == null && sourceFiles.size() == 0 | |||||
| if (textBuffer == null && sourceFiles.size() == 0 | |||||
| && header == null && footer == null) { | && 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); | Project.MSG_INFO); | ||||
| return; | return; | ||||
| } | } | ||||
| @@ -416,16 +416,16 @@ public class Concat extends Task { | |||||
| log("File " + file + " does not exist.", Project.MSG_ERR); | log("File " + file + " does not exist.", Project.MSG_ERR); | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (destinationFile != null | |||||
| if (destinationFile != null | |||||
| && fileUtils.fileNameEquals(destinationFile, file)) { | && fileUtils.fileNameEquals(destinationFile, file)) { | ||||
| throw new BuildException("Input file \"" | |||||
| throw new BuildException("Input file \"" | |||||
| + file + "\" " | + file + "\" " | ||||
| + "is the same as the output file."); | + "is the same as the output file."); | ||||
| } | } | ||||
| sourceFiles.addElement(file); | sourceFiles.addElement(file); | ||||
| } | } | ||||
| } | } | ||||
| /** perform the concatenation */ | /** perform the concatenation */ | ||||
| private void cat() { | private void cat() { | ||||
| OutputStream os = null; | OutputStream os = null; | ||||
| @@ -479,7 +479,7 @@ public class Concat extends Task { | |||||
| } else { | } else { | ||||
| reader = new MultiReader(); | reader = new MultiReader(); | ||||
| } | } | ||||
| concatenate(buffer, writer, reader); | concatenate(buffer, writer, reader); | ||||
| if (footer != null) { | if (footer != null) { | ||||
| @@ -521,7 +521,7 @@ public class Concat extends Task { | |||||
| helper.setProject(getProject()); | helper.setProject(getProject()); | ||||
| in = new BufferedReader(helper.getAssembledReader()); | in = new BufferedReader(helper.getAssembledReader()); | ||||
| } | } | ||||
| while (true) { | while (true) { | ||||
| int nRead = in.read(buffer, 0, buffer.length); | int nRead = in.read(buffer, 0, buffer.length); | ||||
| if (nRead == -1) { | if (nRead == -1) { | ||||
| @@ -529,7 +529,7 @@ public class Concat extends Task { | |||||
| } | } | ||||
| writer.write(buffer, 0, nRead); | writer.write(buffer, 0, nRead); | ||||
| } | } | ||||
| writer.flush(); | writer.flush(); | ||||
| } | } | ||||
| @@ -567,7 +567,7 @@ public class Concat extends Task { | |||||
| public void setFiltering(boolean filtering) { | public void setFiltering(boolean filtering) { | ||||
| this.filtering = filtering; | this.filtering = filtering; | ||||
| } | } | ||||
| /** return the filtering attribute */ | /** return the filtering attribute */ | ||||
| private boolean getFiltering() { | private boolean getFiltering() { | ||||
| return filtering; | return filtering; | ||||
| @@ -576,7 +576,7 @@ public class Concat extends Task { | |||||
| public void setEncoding(String encoding) { | public void setEncoding(String encoding) { | ||||
| this.encoding = encoding; | this.encoding = encoding; | ||||
| } | } | ||||
| /** | /** | ||||
| * set the text using a file | * set the text using a file | ||||
| * @param file the file to use | * @param file the file to use | ||||
| @@ -681,7 +681,7 @@ public class Concat extends Task { | |||||
| private int lastPos = 0; | private int lastPos = 0; | ||||
| private char[] lastChars = new char[eolString.length()]; | private char[] lastChars = new char[eolString.length()]; | ||||
| private boolean needAddSeparator = false; | private boolean needAddSeparator = false; | ||||
| private Reader getReader() throws IOException { | private Reader getReader() throws IOException { | ||||
| if (reader == null) { | if (reader == null) { | ||||
| if (encoding == null) { | if (encoding == null) { | ||||
| @@ -718,7 +718,7 @@ public class Concat extends Task { | |||||
| } | } | ||||
| return ret; | return ret; | ||||
| } | } | ||||
| while (pos < sourceFiles.size()) { | while (pos < sourceFiles.size()) { | ||||
| int ch = getReader().read(); | int ch = getReader().read(); | ||||
| if (ch == -1) { | if (ch == -1) { | ||||
| @@ -732,7 +732,7 @@ public class Concat extends Task { | |||||
| addLastChar((char) ch); | addLastChar((char) ch); | ||||
| return ch; | return ch; | ||||
| } | } | ||||
| pos++; | |||||
| pos++; | |||||
| } | } | ||||
| return -1; | return -1; | ||||
| } | } | ||||
| @@ -378,7 +378,7 @@ public class Copy extends Task { | |||||
| try { | try { | ||||
| ds = fs.getDirectoryScanner(getProject()); | ds = fs.getDirectoryScanner(getProject()); | ||||
| } catch (BuildException e) { | } catch (BuildException e) { | ||||
| if (failonerror | |||||
| if (failonerror | |||||
| || !e.getMessage().endsWith(" not found.")) { | || !e.getMessage().endsWith(" not found.")) { | ||||
| throw e; | throw e; | ||||
| } else { | } else { | ||||
| @@ -386,7 +386,7 @@ public class Copy extends Task { | |||||
| continue; | continue; | ||||
| } | } | ||||
| } | } | ||||
| File fromDir = fs.getDir(getProject()); | File fromDir = fs.getDir(getProject()); | ||||
| String[] srcFiles = ds.getIncludedFiles(); | String[] srcFiles = ds.getIncludedFiles(); | ||||
| @@ -440,20 +440,20 @@ public class Copy extends Task { | |||||
| throw new BuildException("Specify at least one source " | throw new BuildException("Specify at least one source " | ||||
| + "- a file or a fileset."); | + "- a file or a fileset."); | ||||
| } | } | ||||
| if (destFile != null && destDir != null) { | if (destFile != null && destDir != null) { | ||||
| throw new BuildException("Only one of tofile and todir " | throw new BuildException("Only one of tofile and todir " | ||||
| + "may be set."); | + "may be set."); | ||||
| } | } | ||||
| if (destFile == null && destDir == null) { | if (destFile == null && destDir == null) { | ||||
| throw new BuildException("One of tofile or todir must be set."); | throw new BuildException("One of tofile or todir must be set."); | ||||
| } | } | ||||
| if (file != null && file.exists() && file.isDirectory()) { | if (file != null && file.exists() && file.isDirectory()) { | ||||
| throw new BuildException("Use a fileset to copy directories."); | throw new BuildException("Use a fileset to copy directories."); | ||||
| } | } | ||||
| if (destFile != null && filesets.size() > 0) { | if (destFile != null && filesets.size() > 0) { | ||||
| if (filesets.size() > 1) { | if (filesets.size() > 1) { | ||||
| throw new BuildException( | throw new BuildException( | ||||
| @@ -105,7 +105,7 @@ public class Copydir extends MatchingTask { | |||||
| log("DEPRECATED - The copydir task is deprecated. Use copy instead."); | log("DEPRECATED - The copydir task is deprecated. Use copy instead."); | ||||
| if (srcDir == null) { | if (srcDir == null) { | ||||
| throw new BuildException("src attribute must be set!", | |||||
| throw new BuildException("src attribute must be set!", | |||||
| getLocation()); | getLocation()); | ||||
| } | } | ||||
| @@ -115,7 +115,7 @@ public class Copydir extends MatchingTask { | |||||
| } | } | ||||
| if (destDir == null) { | if (destDir == null) { | ||||
| throw new BuildException("The dest attribute must be set.", | |||||
| throw new BuildException("The dest attribute must be set.", | |||||
| getLocation()); | getLocation()); | ||||
| } | } | ||||
| @@ -140,7 +140,7 @@ public class Copydir extends MatchingTask { | |||||
| getProject().copyFile(fromFile, toFile, filtering, | getProject().copyFile(fromFile, toFile, filtering, | ||||
| forceOverwrite); | forceOverwrite); | ||||
| } catch (IOException ioe) { | } catch (IOException ioe) { | ||||
| String msg = "Failed to copy " + fromFile + " to " | |||||
| String msg = "Failed to copy " + fromFile + " to " | |||||
| + toFile + " due to " + ioe.getMessage(); | + toFile + " due to " + ioe.getMessage(); | ||||
| throw new BuildException(msg, ioe, getLocation()); | throw new BuildException(msg, ioe, getLocation()); | ||||
| } | } | ||||
| @@ -77,7 +77,7 @@ public class Copyfile extends Task { | |||||
| private File destFile; | private File destFile; | ||||
| private boolean filtering = false; | private boolean filtering = false; | ||||
| private boolean forceOverwrite = false; | private boolean forceOverwrite = false; | ||||
| public void setSrc(File src) { | public void setSrc(File src) { | ||||
| srcFile = src; | srcFile = src; | ||||
| } | } | ||||
| @@ -98,17 +98,17 @@ public class Copyfile extends Task { | |||||
| log("DEPRECATED - The copyfile task is deprecated. Use copy instead."); | log("DEPRECATED - The copyfile task is deprecated. Use copy instead."); | ||||
| if (srcFile == null) { | if (srcFile == null) { | ||||
| throw new BuildException("The src attribute must be present.", | |||||
| throw new BuildException("The src attribute must be present.", | |||||
| getLocation()); | getLocation()); | ||||
| } | } | ||||
| if (!srcFile.exists()) { | if (!srcFile.exists()) { | ||||
| throw new BuildException("src " + srcFile.toString() | throw new BuildException("src " + srcFile.toString() | ||||
| + " does not exist.", getLocation()); | + " does not exist.", getLocation()); | ||||
| } | } | ||||
| if (destFile == null) { | if (destFile == null) { | ||||
| throw new BuildException("The dest attribute must be present.", | |||||
| throw new BuildException("The dest attribute must be present.", | |||||
| getLocation()); | getLocation()); | ||||
| } | } | ||||
| @@ -116,7 +116,7 @@ public class Copyfile extends Task { | |||||
| log("Warning: src == dest", Project.MSG_WARN); | log("Warning: src == dest", Project.MSG_WARN); | ||||
| } | } | ||||
| if (forceOverwrite | |||||
| if (forceOverwrite | |||||
| || srcFile.lastModified() > destFile.lastModified()) { | || srcFile.lastModified() > destFile.lastModified()) { | ||||
| try { | try { | ||||
| getProject().copyFile(srcFile, destFile, filtering, forceOverwrite); | getProject().copyFile(srcFile, destFile, filtering, forceOverwrite); | ||||
| @@ -65,13 +65,13 @@ package org.apache.tools.ant.taskdefs; | |||||
| * | * | ||||
| * @author costin@dnt.ro | * @author costin@dnt.ro | ||||
| * @author stefano@apache.org | * @author stefano@apache.org | ||||
| * @author Wolfgang Werner | |||||
| * @author Wolfgang Werner | |||||
| * <a href="mailto:wwerner@picturesafe.de">wwerner@picturesafe.de</a> | * <a href="mailto:wwerner@picturesafe.de">wwerner@picturesafe.de</a> | ||||
| * @author Kevin Ross | |||||
| * @author Kevin Ross | |||||
| * <a href="mailto:kevin.ross@bredex.com">kevin.ross@bredex.com</a> | * <a href="mailto:kevin.ross@bredex.com">kevin.ross@bredex.com</a> | ||||
| * | * | ||||
| * @since Ant 1.1 | * @since Ant 1.1 | ||||
| * | |||||
| * | |||||
| * @ant.task category="scm" | * @ant.task category="scm" | ||||
| */ | */ | ||||
| public class Cvs extends AbstractCvsTask { | public class Cvs extends AbstractCvsTask { | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * 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. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * 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. | * 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 | * directory tree. This task combines the functionality of these two | ||||
| * originally distinct tasks. | * originally distinct tasks. | ||||
| * <p>Currently Delete extends MatchingTask. This is intend <i>only</i> | * <p>Currently Delete extends MatchingTask. This is intend <i>only</i> | ||||
| * to provide backwards compatibility for a release. The future position | * to provide backwards compatibility for a release. The future position | ||||
| * is to use nested filesets exclusively.</p> | * is to use nested filesets exclusively.</p> | ||||
| * | |||||
| * @author Stefano Mazzocchi | |||||
| * | |||||
| * @author Stefano Mazzocchi | |||||
| * <a href="mailto:stefano@apache.org">stefano@apache.org</a> | * <a href="mailto:stefano@apache.org">stefano@apache.org</a> | ||||
| * @author Tom Dimock <a href="mailto:tad1@cornell.edu">tad1@cornell.edu</a> | * @author Tom Dimock <a href="mailto:tad1@cornell.edu">tad1@cornell.edu</a> | ||||
| * @author Glenn McAllister | |||||
| * @author Glenn McAllister | |||||
| * <a href="mailto:glennm@ca.ibm.com">glennm@ca.ibm.com</a> | * <a href="mailto:glennm@ca.ibm.com">glennm@ca.ibm.com</a> | ||||
| * @author Jon S. Stevens <a href="mailto:jon@latchkey.com">jon@latchkey.com</a> | * @author Jon S. Stevens <a href="mailto:jon@latchkey.com">jon@latchkey.com</a> | ||||
| * | * | ||||
| @@ -197,7 +197,7 @@ public class Delete extends MatchingTask { | |||||
| usedMatchingTask = true; | usedMatchingTask = true; | ||||
| return super.createIncludesFile(); | return super.createIncludesFile(); | ||||
| } | } | ||||
| /** | /** | ||||
| * add a name entry on the exclude list | * add a name entry on the exclude list | ||||
| */ | */ | ||||
| @@ -213,7 +213,7 @@ public class Delete extends MatchingTask { | |||||
| usedMatchingTask = true; | usedMatchingTask = true; | ||||
| return super.createExcludesFile(); | return super.createExcludesFile(); | ||||
| } | } | ||||
| /** | /** | ||||
| * add a set of patterns | * add a set of patterns | ||||
| */ | */ | ||||
| @@ -410,7 +410,7 @@ public class Delete extends MatchingTask { | |||||
| usedMatchingTask = true; | usedMatchingTask = true; | ||||
| super.addDepend(selector); | super.addDepend(selector); | ||||
| } | } | ||||
| /** | /** | ||||
| * add a regular expression selector entry on the selector list | * 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 " | throw new BuildException("quiet and failonerror cannot both be " | ||||
| + "set to true", getLocation()); | + "set to true", getLocation()); | ||||
| } | } | ||||
| // delete the single file | // delete the single file | ||||
| if (file != null) { | if (file != null) { | ||||
| if (file.exists()) { | if (file.exists()) { | ||||
| if (file.isDirectory()) { | if (file.isDirectory()) { | ||||
| log("Directory " + file.getAbsolutePath() | |||||
| log("Directory " + file.getAbsolutePath() | |||||
| + " cannot be removed using the file attribute. " | + " cannot be removed using the file attribute. " | ||||
| + "Use dir instead."); | + "Use dir instead."); | ||||
| } else { | } else { | ||||
| log("Deleting: " + file.getAbsolutePath()); | log("Deleting: " + file.getAbsolutePath()); | ||||
| if (!file.delete()) { | if (!file.delete()) { | ||||
| String message = "Unable to delete file " | |||||
| String message = "Unable to delete file " | |||||
| + file.getAbsolutePath(); | + file.getAbsolutePath(); | ||||
| if (failonerror) { | if (failonerror) { | ||||
| throw new BuildException(message); | throw new BuildException(message); | ||||
| } else { | |||||
| log(message, quiet ? Project.MSG_VERBOSE | |||||
| } else { | |||||
| log(message, quiet ? Project.MSG_VERBOSE | |||||
| : Project.MSG_WARN); | : Project.MSG_WARN); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } else { | } else { | ||||
| log("Could not find file " + file.getAbsolutePath() | |||||
| + " to delete.", | |||||
| log("Could not find file " + file.getAbsolutePath() | |||||
| + " to delete.", | |||||
| Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
| } | } | ||||
| } | } | ||||
| // delete the directory | // delete the directory | ||||
| if (dir != null && dir.exists() && dir.isDirectory() && | |||||
| if (dir != null && dir.exists() && dir.isDirectory() && | |||||
| !usedMatchingTask) { | !usedMatchingTask) { | ||||
| /* | /* | ||||
| If verbosity is MSG_VERBOSE, that mean we are doing | If verbosity is MSG_VERBOSE, that mean we are doing | ||||
| @@ -506,7 +506,7 @@ public class Delete extends MatchingTask { | |||||
| if (failonerror) { | if (failonerror) { | ||||
| throw be; | throw be; | ||||
| } else { | } else { | ||||
| log(be.getMessage(), | |||||
| log(be.getMessage(), | |||||
| quiet ? Project.MSG_VERBOSE : Project.MSG_WARN); | quiet ? Project.MSG_VERBOSE : Project.MSG_WARN); | ||||
| } | } | ||||
| } | } | ||||
| @@ -524,7 +524,7 @@ public class Delete extends MatchingTask { | |||||
| if (failonerror) { | if (failonerror) { | ||||
| throw be; | throw be; | ||||
| } else { | } else { | ||||
| log(be.getMessage(), | |||||
| log(be.getMessage(), | |||||
| quiet ? Project.MSG_VERBOSE : Project.MSG_WARN); | quiet ? Project.MSG_VERBOSE : Project.MSG_WARN); | ||||
| } | } | ||||
| } | } | ||||
| @@ -548,7 +548,7 @@ public class Delete extends MatchingTask { | |||||
| } else { | } else { | ||||
| log("Deleting " + f.getAbsolutePath(), verbosity); | log("Deleting " + f.getAbsolutePath(), verbosity); | ||||
| if (!f.delete()) { | if (!f.delete()) { | ||||
| String message = "Unable to delete file " | |||||
| String message = "Unable to delete file " | |||||
| + f.getAbsolutePath(); | + f.getAbsolutePath(); | ||||
| if (failonerror) { | if (failonerror) { | ||||
| throw new BuildException(message); | throw new BuildException(message); | ||||
| @@ -561,7 +561,7 @@ public class Delete extends MatchingTask { | |||||
| } | } | ||||
| log("Deleting directory " + d.getAbsolutePath(), verbosity); | log("Deleting directory " + d.getAbsolutePath(), verbosity); | ||||
| if (!d.delete()) { | if (!d.delete()) { | ||||
| String message = "Unable to delete directory " | |||||
| String message = "Unable to delete directory " | |||||
| + dir.getAbsolutePath(); | + dir.getAbsolutePath(); | ||||
| if (failonerror) { | if (failonerror) { | ||||
| throw new BuildException(message); | throw new BuildException(message); | ||||
| @@ -581,13 +581,13 @@ public class Delete extends MatchingTask { | |||||
| */ | */ | ||||
| protected void removeFiles(File d, String[] files, String[] dirs) { | protected void removeFiles(File d, String[] files, String[] dirs) { | ||||
| if (files.length > 0) { | if (files.length > 0) { | ||||
| log("Deleting " + files.length + " files from " | |||||
| log("Deleting " + files.length + " files from " | |||||
| + d.getAbsolutePath()); | + d.getAbsolutePath()); | ||||
| for (int j = 0; j < files.length; j++) { | for (int j = 0; j < files.length; j++) { | ||||
| File f = new File(d, files[j]); | File f = new File(d, files[j]); | ||||
| log("Deleting " + f.getAbsolutePath(), verbosity); | log("Deleting " + f.getAbsolutePath(), verbosity); | ||||
| if (!f.delete()) { | if (!f.delete()) { | ||||
| String message = "Unable to delete file " | |||||
| String message = "Unable to delete file " | |||||
| + f.getAbsolutePath(); | + f.getAbsolutePath(); | ||||
| if (failonerror) { | if (failonerror) { | ||||
| throw new BuildException(message); | throw new BuildException(message); | ||||
| @@ -135,13 +135,13 @@ public class Deltree extends Task { | |||||
| removeDir(f); | removeDir(f); | ||||
| } else { | } else { | ||||
| if (!f.delete()) { | if (!f.delete()) { | ||||
| throw new BuildException("Unable to delete file " | |||||
| throw new BuildException("Unable to delete file " | |||||
| + f.getAbsolutePath()); | + f.getAbsolutePath()); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if (!dir.delete()) { | if (!dir.delete()) { | ||||
| throw new BuildException("Unable to delete directory " | |||||
| throw new BuildException("Unable to delete directory " | |||||
| + dir.getAbsolutePath()); | + dir.getAbsolutePath()); | ||||
| } | } | ||||
| } | } | ||||
| @@ -99,8 +99,8 @@ public class Ear extends Jar { | |||||
| public void setAppxml(File descr) { | public void setAppxml(File descr) { | ||||
| deploymentDescriptor = descr; | deploymentDescriptor = descr; | ||||
| if (!deploymentDescriptor.exists()) { | if (!deploymentDescriptor.exists()) { | ||||
| throw new BuildException("Deployment descriptor: " | |||||
| + deploymentDescriptor | |||||
| throw new BuildException("Deployment descriptor: " | |||||
| + deploymentDescriptor | |||||
| + " does not exist."); | + " does not exist."); | ||||
| } | } | ||||
| @@ -138,7 +138,7 @@ public class Ear extends Jar { | |||||
| /** | /** | ||||
| * Overriden from Zip class to deal with application.xml | * 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) | int mode) | ||||
| throws IOException { | throws IOException { | ||||
| // If the file being added is META-INF/application.xml, we | // 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 | // file is specified by the "appxml" attribute and in a | ||||
| // <fileset> element. | // <fileset> element. | ||||
| if (vPath.equalsIgnoreCase("META-INF/application.xml")) { | if (vPath.equalsIgnoreCase("META-INF/application.xml")) { | ||||
| if (deploymentDescriptor == null | |||||
| if (deploymentDescriptor == null | |||||
| || !fu.fileNameEquals(deploymentDescriptor, file) | || !fu.fileNameEquals(deploymentDescriptor, file) | ||||
| || descriptorAdded) { | || descriptorAdded) { | ||||
| log("Warning: selected " + archiveType | log("Warning: selected " + archiveType | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * 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. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * 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 String message = ""; // required | ||||
| protected File file = null; | protected File file = null; | ||||
| protected boolean append = false; | protected boolean append = false; | ||||
| // by default, messages are always displayed | // by default, messages are always displayed | ||||
| protected int logLevel = Project.MSG_WARN; | |||||
| protected int logLevel = Project.MSG_WARN; | |||||
| /** | /** | ||||
| * Does the work. | * Does the work. | ||||
| * | * | ||||
| @@ -166,7 +166,7 @@ public class Echo extends Task { | |||||
| * @see EnumeratedAttribute#getValues | * @see EnumeratedAttribute#getValues | ||||
| */ | */ | ||||
| public String[] getValues() { | public String[] getValues() { | ||||
| return new String[] {"error", "warning", "info", | |||||
| return new String[] {"error", "warning", "info", | |||||
| "verbose", "debug"}; | "verbose", "debug"}; | ||||
| } | } | ||||
| } | } | ||||
| @@ -76,7 +76,7 @@ import org.apache.tools.ant.Task; | |||||
| * @author duncan@x180.com | * @author duncan@x180.com | ||||
| * @author rubys@us.ibm.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. | * instead. | ||||
| */ | */ | ||||
| public class Exec extends Task { | public class Exec extends Task { | ||||
| @@ -88,9 +88,9 @@ public class Exec extends Task { | |||||
| private boolean failOnError = false; | private boolean failOnError = false; | ||||
| public Exec() { | 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"); | + "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."); | + "developers and is unmaintained."); | ||||
| System.err.println("Don\'t use it!"); | System.err.println("Don\'t use it!"); | ||||
| } | } | ||||
| @@ -124,10 +124,10 @@ public class Exec extends Task { | |||||
| } else { | } else { | ||||
| String ant = getProject().getProperty("ant.home"); | String ant = getProject().getProperty("ant.home"); | ||||
| if (ant == null) { | if (ant == null) { | ||||
| throw new BuildException("Property 'ant.home' not " | |||||
| throw new BuildException("Property 'ant.home' not " | |||||
| + "found", getLocation()); | + "found", getLocation()); | ||||
| } | } | ||||
| String antRun = getProject().resolveFile(ant + "/bin/antRun.bat").toString(); | String antRun = getProject().resolveFile(ant + "/bin/antRun.bat").toString(); | ||||
| command = antRun + " " + dir + " " + command; | command = antRun + " " + dir + " " + command; | ||||
| } | } | ||||
| @@ -212,7 +212,7 @@ public class Exec extends Task { | |||||
| protected void outputLog(String line, int messageLevel) { | protected void outputLog(String line, int messageLevel) { | ||||
| if (fos == null) { | if (fos == null) { | ||||
| log(line, messageLevel); | |||||
| log(line, messageLevel); | |||||
| } else { | } else { | ||||
| fos.println(line); | fos.println(line); | ||||
| } | } | ||||
| @@ -79,7 +79,7 @@ import org.apache.tools.ant.util.FileUtils; | |||||
| public class ExecTask extends Task { | public class ExecTask extends Task { | ||||
| private String os; | private String os; | ||||
| private File dir; | private File dir; | ||||
| protected boolean failOnError = false; | protected boolean failOnError = false; | ||||
| protected boolean newEnvironment = false; | protected boolean newEnvironment = false; | ||||
| @@ -92,7 +92,7 @@ public class ExecTask extends Task { | |||||
| private boolean resolveExecutable = false; | private boolean resolveExecutable = false; | ||||
| private Redirector redirector = new Redirector(this); | private Redirector redirector = new Redirector(this); | ||||
| /** | /** | ||||
| * Controls whether the VM (1.3 and above) is used to execute the | * Controls whether the VM (1.3 and above) is used to execute the | ||||
| * command | * 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 | * redirected, it too will appear in the output | ||||
| */ | */ | ||||
| public void setOutput(File out) { | public void setOutput(File out) { | ||||
| @@ -174,7 +174,7 @@ public class ExecTask extends Task { | |||||
| public void setInputString(String inputString) { | public void setInputString(String inputString) { | ||||
| redirector.setInputString(inputString); | redirector.setInputString(inputString); | ||||
| } | } | ||||
| /** | /** | ||||
| * Controls whether error output of exec is logged. This is only useful | * Controls whether error output of exec is logged. This is only useful | ||||
| * when output is being redirected and error output is desired in the | * 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) { | public void setLogError(boolean logError) { | ||||
| redirector.setLogError(logError); | redirector.setLogError(logError); | ||||
| } | } | ||||
| /** | /** | ||||
| * File the error stream of the process is redirected to. | * File the error stream of the process is redirected to. | ||||
| * | * | ||||
| @@ -231,7 +231,7 @@ public class ExecTask extends Task { | |||||
| public void setResolveExecutable(boolean resolveExecutable) { | public void setResolveExecutable(boolean resolveExecutable) { | ||||
| this.resolveExecutable = resolveExecutable; | this.resolveExecutable = resolveExecutable; | ||||
| } | } | ||||
| /** | /** | ||||
| * Add an environment variable to the launched process. | * Add an environment variable to the launched process. | ||||
| */ | */ | ||||
| @@ -286,10 +286,10 @@ public class ExecTask extends Task { | |||||
| redirector.setAppend(append); | 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 | * the full path - first try basedir, then the exec dir and then | ||||
| * fallback to the straight executable name (i.e. on ther path) | * fallback to the straight executable name (i.e. on ther path) | ||||
| * | * | ||||
| @@ -299,13 +299,13 @@ public class ExecTask extends Task { | |||||
| if (!resolveExecutable) { | if (!resolveExecutable) { | ||||
| return executable; | return executable; | ||||
| } | } | ||||
| // try to find the executable | // try to find the executable | ||||
| File executableFile = getProject().resolveFile(executable); | File executableFile = getProject().resolveFile(executable); | ||||
| if (executableFile.exists()) { | if (executableFile.exists()) { | ||||
| return executableFile.getAbsolutePath(); | return executableFile.getAbsolutePath(); | ||||
| } | } | ||||
| // now try to resolve against the dir if given | // now try to resolve against the dir if given | ||||
| if (dir != null) { | if (dir != null) { | ||||
| FileUtils fileUtils = FileUtils.newFileUtils(); | FileUtils fileUtils = FileUtils.newFileUtils(); | ||||
| @@ -316,9 +316,9 @@ public class ExecTask extends Task { | |||||
| } | } | ||||
| // couldn't find it - must be on path | // couldn't find it - must be on path | ||||
| return executable; | |||||
| return executable; | |||||
| } | } | ||||
| /** | /** | ||||
| * Do the work. | * 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. | * 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; | this.vmLauncher = vmLauncher; | ||||
| } | } | ||||
| @@ -415,7 +415,7 @@ public class ExecTask extends Task { | |||||
| maybeSetResultPropertyValue(returnCode); | maybeSetResultPropertyValue(returnCode); | ||||
| if (returnCode != 0) { | if (returnCode != 0) { | ||||
| if (failOnError) { | if (failOnError) { | ||||
| throw new BuildException(getTaskType() + " returned: " | |||||
| throw new BuildException(getTaskType() + " returned: " | |||||
| + returnCode, getLocation()); | + returnCode, getLocation()); | ||||
| } else { | } else { | ||||
| log("Result: " + returnCode, Project.MSG_ERR); | log("Result: " + returnCode, Project.MSG_ERR); | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * 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. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * 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; | import org.apache.tools.ant.util.SourceFileScanner; | ||||
| /** | /** | ||||
| * Executes a given command, supplying a set of files as arguments. | |||||
| * Executes a given command, supplying a set of files as arguments. | |||||
| * | * | ||||
| * @author Stefan Bodewig | |||||
| * @author Stefan Bodewig | |||||
| * @author <a href="mailto:mariusz@rakiura.org">Mariusz Nowostawski</a> | * @author <a href="mailto:mariusz@rakiura.org">Mariusz Nowostawski</a> | ||||
| * | * | ||||
| * @since Ant 1.2 | * @since Ant 1.2 | ||||
| @@ -120,7 +120,7 @@ public class ExecuteOn extends ExecTask { | |||||
| * @since Ant 1.6 | * @since Ant 1.6 | ||||
| */ | */ | ||||
| public void addDirset(DirSet set) { | public void addDirset(DirSet set) { | ||||
| filesets.addElement(set); | |||||
| filesets.addElement(set); | |||||
| } | } | ||||
| /** | /** | ||||
| * Source files to operate upon. | * Source files to operate upon. | ||||
| @@ -257,21 +257,21 @@ public class ExecuteOn extends ExecTask { | |||||
| if ("execon".equals(getTaskName())) { | if ("execon".equals(getTaskName())) { | ||||
| log("!! execon is deprecated. Use apply instead. !!"); | log("!! execon is deprecated. Use apply instead. !!"); | ||||
| } | } | ||||
| super.checkConfiguration(); | super.checkConfiguration(); | ||||
| if (filesets.size() == 0 && filelists.size() == 0) { | if (filesets.size() == 0 && filelists.size() == 0) { | ||||
| throw new BuildException("no filesets and no filelists specified", | throw new BuildException("no filesets and no filelists specified", | ||||
| getLocation()); | getLocation()); | ||||
| } | } | ||||
| if (targetFilePos != null || mapperElement != null | |||||
| if (targetFilePos != null || mapperElement != null | |||||
| || destDir != null) { | || destDir != null) { | ||||
| if (mapperElement == null) { | if (mapperElement == null) { | ||||
| throw new BuildException("no mapper specified", getLocation()); | throw new BuildException("no mapper specified", getLocation()); | ||||
| } | } | ||||
| if (destDir == null) { | if (destDir == null) { | ||||
| throw new BuildException("no dest attribute specified", | |||||
| throw new BuildException("no dest attribute specified", | |||||
| getLocation()); | getLocation()); | ||||
| } | } | ||||
| mapper = mapperElement.getImplementation(); | mapper = mapperElement.getImplementation(); | ||||
| @@ -291,7 +291,7 @@ public class ExecuteOn extends ExecTask { | |||||
| AbstractFileSet fs = (AbstractFileSet) filesets.elementAt(i); | AbstractFileSet fs = (AbstractFileSet) filesets.elementAt(i); | ||||
| if (fs instanceof DirSet) { | if (fs instanceof DirSet) { | ||||
| if (!"dir".equals(type)) { | 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" + | + "Temporarily switching to type=\"dir\" on the" + | ||||
| " assumption that you really did mean" + | " assumption that you really did mean" + | ||||
| " <dirset> not <fileset>.", Project.MSG_DEBUG); | " <dirset> not <fileset>.", Project.MSG_DEBUG); | ||||
| @@ -330,7 +330,7 @@ public class ExecuteOn extends ExecTask { | |||||
| fileNames.copyInto(s); | fileNames.copyInto(s); | ||||
| for (int j = 0; j < s.length; j++) { | for (int j = 0; j < s.length; j++) { | ||||
| String[] command = getCommandline(s[j], base); | String[] command = getCommandline(s[j], base); | ||||
| log(Commandline.describeCommand(command), | |||||
| log(Commandline.describeCommand(command), | |||||
| Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
| exe.setCommandline(command); | exe.setCommandline(command); | ||||
| runExecute(exe); | runExecute(exe); | ||||
| @@ -373,7 +373,7 @@ public class ExecuteOn extends ExecTask { | |||||
| fileNames.copyInto(s); | fileNames.copyInto(s); | ||||
| for (int j = 0; j < s.length; j++) { | for (int j = 0; j < s.length; j++) { | ||||
| String[] command = getCommandline(s[j], base); | String[] command = getCommandline(s[j], base); | ||||
| log(Commandline.describeCommand(command), | |||||
| log(Commandline.describeCommand(command), | |||||
| Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
| exe.setCommandline(command); | exe.setCommandline(command); | ||||
| runExecute(exe); | runExecute(exe); | ||||
| @@ -440,13 +440,13 @@ public class ExecuteOn extends ExecTask { | |||||
| } | } | ||||
| String[] targetFiles = new String[targets.size()]; | String[] targetFiles = new String[targets.size()]; | ||||
| targets.copyInto(targetFiles); | targets.copyInto(targetFiles); | ||||
| if (!addSourceFile) { | if (!addSourceFile) { | ||||
| srcFiles = new String[0]; | srcFiles = new String[0]; | ||||
| } | } | ||||
| String[] orig = cmdl.getCommandline(); | String[] orig = cmdl.getCommandline(); | ||||
| String[] result | |||||
| String[] result | |||||
| = new String[orig.length + srcFiles.length + targetFiles.length]; | = new String[orig.length + srcFiles.length + targetFiles.length]; | ||||
| int srcIndex = orig.length; | int srcIndex = orig.length; | ||||
| @@ -457,42 +457,42 @@ public class ExecuteOn extends ExecTask { | |||||
| if (targetFilePos != null) { | if (targetFilePos != null) { | ||||
| int targetIndex = targetFilePos.getPosition(); | int targetIndex = targetFilePos.getPosition(); | ||||
| if (srcIndex < targetIndex | |||||
| if (srcIndex < targetIndex | |||||
| || (srcIndex == targetIndex && srcIsFirst)) { | || (srcIndex == targetIndex && srcIsFirst)) { | ||||
| // 0 --> srcIndex | // 0 --> srcIndex | ||||
| System.arraycopy(orig, 0, result, 0, srcIndex); | System.arraycopy(orig, 0, result, 0, srcIndex); | ||||
| // srcIndex --> targetIndex | // srcIndex --> targetIndex | ||||
| System.arraycopy(orig, srcIndex, result, | |||||
| System.arraycopy(orig, srcIndex, result, | |||||
| srcIndex + srcFiles.length, | srcIndex + srcFiles.length, | ||||
| targetIndex - srcIndex); | targetIndex - srcIndex); | ||||
| // targets are already absolute file names | // targets are already absolute file names | ||||
| System.arraycopy(targetFiles, 0, result, | |||||
| targetIndex + srcFiles.length, | |||||
| System.arraycopy(targetFiles, 0, result, | |||||
| targetIndex + srcFiles.length, | |||||
| targetFiles.length); | targetFiles.length); | ||||
| // targetIndex --> end | // targetIndex --> end | ||||
| System.arraycopy(orig, targetIndex, result, | |||||
| System.arraycopy(orig, targetIndex, result, | |||||
| targetIndex + srcFiles.length + targetFiles.length, | targetIndex + srcFiles.length + targetFiles.length, | ||||
| orig.length - targetIndex); | orig.length - targetIndex); | ||||
| } else { | } else { | ||||
| // 0 --> targetIndex | // 0 --> targetIndex | ||||
| System.arraycopy(orig, 0, result, 0, targetIndex); | System.arraycopy(orig, 0, result, 0, targetIndex); | ||||
| // targets are already absolute file names | // targets are already absolute file names | ||||
| System.arraycopy(targetFiles, 0, result, | |||||
| System.arraycopy(targetFiles, 0, result, | |||||
| targetIndex, | targetIndex, | ||||
| targetFiles.length); | targetFiles.length); | ||||
| // targetIndex --> srcIndex | // targetIndex --> srcIndex | ||||
| System.arraycopy(orig, targetIndex, result, | |||||
| System.arraycopy(orig, targetIndex, result, | |||||
| targetIndex + targetFiles.length, | targetIndex + targetFiles.length, | ||||
| srcIndex - targetIndex); | srcIndex - targetIndex); | ||||
| // srcIndex --> end | // srcIndex --> end | ||||
| System.arraycopy(orig, srcIndex, result, | |||||
| System.arraycopy(orig, srcIndex, result, | |||||
| srcIndex + srcFiles.length + targetFiles.length, | srcIndex + srcFiles.length + targetFiles.length, | ||||
| orig.length - srcIndex); | orig.length - srcIndex); | ||||
| srcIndex += targetFiles.length; | srcIndex += targetFiles.length; | ||||
| @@ -503,7 +503,7 @@ public class ExecuteOn extends ExecTask { | |||||
| // 0 --> srcIndex | // 0 --> srcIndex | ||||
| System.arraycopy(orig, 0, result, 0, srcIndex); | System.arraycopy(orig, 0, result, 0, srcIndex); | ||||
| // srcIndex --> end | // srcIndex --> end | ||||
| System.arraycopy(orig, srcIndex, result, | |||||
| System.arraycopy(orig, srcIndex, result, | |||||
| srcIndex + srcFiles.length, | srcIndex + srcFiles.length, | ||||
| orig.length - srcIndex); | orig.length - srcIndex); | ||||
| @@ -512,13 +512,13 @@ public class ExecuteOn extends ExecTask { | |||||
| // fill in source file names | // fill in source file names | ||||
| for (int i = 0; i < srcFiles.length; i++) { | for (int i = 0; i < srcFiles.length; i++) { | ||||
| if (!relative) { | if (!relative) { | ||||
| result[srcIndex + i] = | |||||
| result[srcIndex + i] = | |||||
| (new File(baseDirs[i], srcFiles[i])).getAbsolutePath(); | (new File(baseDirs[i], srcFiles[i])).getAbsolutePath(); | ||||
| } else { | } else { | ||||
| result[srcIndex + i] = srcFiles[i]; | result[srcIndex + i] = srcFiles[i]; | ||||
| } | } | ||||
| if (forwardSlash && fileSeparator != '/') { | if (forwardSlash && fileSeparator != '/') { | ||||
| result[srcIndex + i] = | |||||
| result[srcIndex + i] = | |||||
| result[srcIndex + i].replace(fileSeparator, '/'); | result[srcIndex + i].replace(fileSeparator, '/'); | ||||
| } | } | ||||
| } | } | ||||
| @@ -542,7 +542,7 @@ public class ExecuteOn extends ExecTask { | |||||
| protected String[] getFiles(File baseDir, DirectoryScanner ds) { | protected String[] getFiles(File baseDir, DirectoryScanner ds) { | ||||
| if (mapper != null) { | if (mapper != null) { | ||||
| SourceFileScanner sfs = new SourceFileScanner(this); | SourceFileScanner sfs = new SourceFileScanner(this); | ||||
| return sfs.restrict(ds.getIncludedFiles(), baseDir, destDir, | |||||
| return sfs.restrict(ds.getIncludedFiles(), baseDir, destDir, | |||||
| mapper); | mapper); | ||||
| } else { | } else { | ||||
| return ds.getIncludedFiles(); | return ds.getIncludedFiles(); | ||||
| @@ -556,7 +556,7 @@ public class ExecuteOn extends ExecTask { | |||||
| protected String[] getDirs(File baseDir, DirectoryScanner ds) { | protected String[] getDirs(File baseDir, DirectoryScanner ds) { | ||||
| if (mapper != null) { | if (mapper != null) { | ||||
| SourceFileScanner sfs = new SourceFileScanner(this); | SourceFileScanner sfs = new SourceFileScanner(this); | ||||
| return sfs.restrict(ds.getIncludedDirectories(), baseDir, destDir, | |||||
| return sfs.restrict(ds.getIncludedDirectories(), baseDir, destDir, | |||||
| mapper); | mapper); | ||||
| } else { | } else { | ||||
| return ds.getIncludedDirectories(); | return ds.getIncludedDirectories(); | ||||
| @@ -569,7 +569,7 @@ public class ExecuteOn extends ExecTask { | |||||
| * | * | ||||
| * @since Ant 1.6 | * @since Ant 1.6 | ||||
| */ | */ | ||||
| protected void runParallel(Execute exe, Vector fileNames, | |||||
| protected void runParallel(Execute exe, Vector fileNames, | |||||
| Vector baseDirs) | Vector baseDirs) | ||||
| throws IOException, BuildException { | throws IOException, BuildException { | ||||
| String[] s = new String[fileNames.size()]; | String[] s = new String[fileNames.size()]; | ||||
| @@ -577,7 +577,7 @@ public class ExecuteOn extends ExecTask { | |||||
| File[] b = new File[baseDirs.size()]; | File[] b = new File[baseDirs.size()]; | ||||
| baseDirs.copyInto(b); | baseDirs.copyInto(b); | ||||
| if (maxParallel <= 0 | |||||
| if (maxParallel <= 0 | |||||
| || s.length == 0 /* this is skipEmpty == false */) { | || s.length == 0 /* this is skipEmpty == false */) { | ||||
| String[] command = getCommandline(s, b); | String[] command = getCommandline(s, b); | ||||
| log(Commandline.describeCommand(command), Project.MSG_VERBOSE); | 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" | * Enumerated attribute with the values "file", "dir" and "both" | ||||
| * for the type attribute. | |||||
| * for the type attribute. | |||||
| */ | */ | ||||
| public static class FileDirBoth extends EnumeratedAttribute { | public static class FileDirBoth extends EnumeratedAttribute { | ||||
| /** | /** | ||||
| @@ -70,7 +70,7 @@ import org.apache.tools.ant.util.Watchdog; | |||||
| * // it was killed on purpose by the watchdog | * // it was killed on purpose by the watchdog | ||||
| * } | * } | ||||
| * </pre> | * </pre> | ||||
| * @author thomas.haas@softwired-inc.com | * @author thomas.haas@softwired-inc.com | ||||
| * @author <a href="mailto:sbailliez_at_apache.org">Stephane Bailliez</a> | * @author <a href="mailto:sbailliez_at_apache.org">Stephane Bailliez</a> | ||||
| * @see Execute | * @see Execute | ||||
| @@ -78,13 +78,13 @@ import org.apache.tools.ant.util.Watchdog; | |||||
| * @since Ant 1.2 | * @since Ant 1.2 | ||||
| */ | */ | ||||
| public class ExecuteWatchdog implements TimeoutObserver { | public class ExecuteWatchdog implements TimeoutObserver { | ||||
| /** the process to execute and watch for duration */ | /** the process to execute and watch for duration */ | ||||
| private Process process; | private Process process; | ||||
| /** say whether or not the watchog is currently monitoring a process */ | /** say whether or not the watchog is currently monitoring a process */ | ||||
| private boolean watch = false; | private boolean watch = false; | ||||
| /** exception that might be thrown during the process execution */ | /** exception that might be thrown during the process execution */ | ||||
| private Exception caught = null; | private Exception caught = null; | ||||
| @@ -97,7 +97,7 @@ public class ExecuteWatchdog implements TimeoutObserver { | |||||
| /** | /** | ||||
| * Creates a new watchdog with a given timeout. | * 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. | * It must be greather than 0. | ||||
| */ | */ | ||||
| public ExecuteWatchdog(long timeout) { | 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. | * on this object. | ||||
| */ | */ | ||||
| public synchronized void stop() { | 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. | * 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. | * silently swallowed and stored during the process run. | ||||
| */ | */ | ||||
| public void checkException() throws BuildException { | 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. | * Indicates whether or not the watchdog is still monitoring the process. | ||||
| * @return <tt>true</tt> if the process is still running, otherwise | |||||
| * @return <tt>true</tt> if the process is still running, otherwise | |||||
| * <tt>false</tt>. | * <tt>false</tt>. | ||||
| */ | */ | ||||
| public boolean isWatching(){ | public boolean isWatching(){ | ||||
| @@ -202,7 +202,7 @@ public class ExecuteWatchdog implements TimeoutObserver { | |||||
| /** | /** | ||||
| * Indicates whether the last process run was killed on timeout or not. | * Indicates whether the last process run was killed on timeout or not. | ||||
| * @return <tt>true</tt> if the process was killed otherwise | |||||
| * @return <tt>true</tt> if the process was killed otherwise | |||||
| * <tt>false</tt>. | * <tt>false</tt>. | ||||
| */ | */ | ||||
| public boolean killedProcess(){ | public boolean killedProcess(){ | ||||
| @@ -1025,7 +1025,7 @@ public class FixCRLF extends MatchingTask { | |||||
| * @see EnumeratedAttribute#getValues | * @see EnumeratedAttribute#getValues | ||||
| */ | */ | ||||
| public String[] getValues() { | public String[] getValues() { | ||||
| return new String[] {"asis", "cr", "lf", "crlf", | |||||
| return new String[] {"asis", "cr", "lf", "crlf", | |||||
| "mac", "unix", "dos"}; | "mac", "unix", "dos"}; | ||||
| } | } | ||||
| } | } | ||||
| @@ -62,7 +62,7 @@ import org.apache.tools.ant.util.JavaEnvUtils; | |||||
| /** | /** | ||||
| * Generates a key in a keystore. | * Generates a key in a keystore. | ||||
| * | |||||
| * | |||||
| * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | ||||
| * | * | ||||
| * @since Ant 1.2 | * @since Ant 1.2 | ||||
| @@ -74,15 +74,15 @@ public class GenerateKey extends Task { | |||||
| public static class DnameParam { | public static class DnameParam { | ||||
| private String name; | private String name; | ||||
| private String value; | private String value; | ||||
| public void setName(String name) { | public void setName(String name) { | ||||
| this.name = name; | this.name = name; | ||||
| } | } | ||||
| public String getName() { | public String getName() { | ||||
| return name; | return name; | ||||
| } | } | ||||
| public void setValue(String value) { | public void setValue(String value) { | ||||
| this.value = value; | this.value = value; | ||||
| } | } | ||||
| @@ -94,14 +94,14 @@ public class GenerateKey extends Task { | |||||
| public static class DistinguishedName { | public static class DistinguishedName { | ||||
| private Vector params = new Vector(); | private Vector params = new Vector(); | ||||
| public Object createParam() { | public Object createParam() { | ||||
| DnameParam param = new DnameParam(); | DnameParam param = new DnameParam(); | ||||
| params.addElement(param); | params.addElement(param); | ||||
| return param; | return param; | ||||
| } | } | ||||
| public Enumeration getParams() { | public Enumeration getParams() { | ||||
| return params.elements(); | return params.elements(); | ||||
| } | } | ||||
| @@ -122,7 +122,7 @@ public class GenerateKey extends Task { | |||||
| sb.append('='); | sb.append('='); | ||||
| sb.append(encode(param.getValue())); | sb.append(encode(param.getValue())); | ||||
| } | } | ||||
| return sb.toString(); | return sb.toString(); | ||||
| } | } | ||||
| @@ -132,9 +132,9 @@ public class GenerateKey extends Task { | |||||
| if (-1 == end) { | if (-1 == end) { | ||||
| return string; | return string; | ||||
| } | } | ||||
| final StringBuffer sb = new StringBuffer(); | final StringBuffer sb = new StringBuffer(); | ||||
| int start = 0; | int start = 0; | ||||
| while (-1 != end) { | while (-1 != end) { | ||||
| @@ -145,8 +145,8 @@ public class GenerateKey extends Task { | |||||
| } | } | ||||
| sb.append(string.substring(start)); | 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. | * @todo Could convert this to a plain Integer setter. | ||||
| */ | */ | ||||
| public void setKeysize(final String keysize) throws BuildException { | public void setKeysize(final String keysize) throws BuildException { | ||||
| try { | |||||
| this.keysize = Integer.parseInt(keysize); | |||||
| try { | |||||
| this.keysize = Integer.parseInt(keysize); | |||||
| } catch (final NumberFormatException nfe) { | } catch (final NumberFormatException nfe) { | ||||
| throw new BuildException("KeySize attribute should be a integer"); | throw new BuildException("KeySize attribute should be a integer"); | ||||
| } | } | ||||
| @@ -290,8 +290,8 @@ public class GenerateKey extends Task { | |||||
| * @throws BuildException If not an Integer | * @throws BuildException If not an Integer | ||||
| */ | */ | ||||
| public void setValidity(final String validity) throws BuildException { | public void setValidity(final String validity) throws BuildException { | ||||
| try { | |||||
| this.validity = Integer.parseInt(validity); | |||||
| try { | |||||
| this.validity = Integer.parseInt(validity); | |||||
| } catch (final NumberFormatException nfe) { | } catch (final NumberFormatException nfe) { | ||||
| throw new BuildException("Validity attribute should be a integer"); | throw new BuildException("Validity attribute should be a integer"); | ||||
| } | } | ||||
| @@ -303,7 +303,7 @@ public class GenerateKey extends Task { | |||||
| */ | */ | ||||
| public void setVerbose(final boolean verbose) { | public void setVerbose(final boolean verbose) { | ||||
| this.verbose = verbose; | this.verbose = verbose; | ||||
| } | |||||
| } | |||||
| public void execute() throws BuildException { | public void execute() throws BuildException { | ||||
| if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) { | if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) { | ||||
| @@ -313,15 +313,15 @@ public class GenerateKey extends Task { | |||||
| if (null == alias) { | if (null == alias) { | ||||
| throw new BuildException("alias attribute must be set"); | throw new BuildException("alias attribute must be set"); | ||||
| } | |||||
| } | |||||
| if (null == storepass) { | if (null == storepass) { | ||||
| throw new BuildException("storepass attribute must be set"); | throw new BuildException("storepass attribute must be set"); | ||||
| } | |||||
| } | |||||
| if (null == dname && null == expandedDname) { | if (null == dname && null == expandedDname) { | ||||
| throw new BuildException("dname must be set"); | throw new BuildException("dname must be set"); | ||||
| } | |||||
| } | |||||
| final StringBuffer sb = new StringBuffer(); | final StringBuffer sb = new StringBuffer(); | ||||
| @@ -329,7 +329,7 @@ public class GenerateKey extends Task { | |||||
| if (verbose) { | if (verbose) { | ||||
| sb.append("-v "); | sb.append("-v "); | ||||
| } | |||||
| } | |||||
| sb.append("-alias \""); | sb.append("-alias \""); | ||||
| sb.append(alias); | sb.append(alias); | ||||
| @@ -339,13 +339,13 @@ public class GenerateKey extends Task { | |||||
| sb.append("-dname \""); | sb.append("-dname \""); | ||||
| sb.append(dname); | sb.append(dname); | ||||
| sb.append("\" "); | sb.append("\" "); | ||||
| } | |||||
| } | |||||
| if (null != expandedDname) { | if (null != expandedDname) { | ||||
| sb.append("-dname \""); | sb.append("-dname \""); | ||||
| sb.append(expandedDname); | sb.append(expandedDname); | ||||
| sb.append("\" "); | sb.append("\" "); | ||||
| } | |||||
| } | |||||
| if (null != keystore) { | if (null != keystore) { | ||||
| sb.append("-keystore \""); | sb.append("-keystore \""); | ||||
| @@ -357,13 +357,13 @@ public class GenerateKey extends Task { | |||||
| sb.append("-storepass \""); | sb.append("-storepass \""); | ||||
| sb.append(storepass); | sb.append(storepass); | ||||
| sb.append("\" "); | sb.append("\" "); | ||||
| } | |||||
| } | |||||
| if (null != storetype) { | if (null != storetype) { | ||||
| sb.append("-storetype \""); | sb.append("-storetype \""); | ||||
| sb.append(storetype); | sb.append(storetype); | ||||
| sb.append("\" "); | sb.append("\" "); | ||||
| } | |||||
| } | |||||
| sb.append("-keypass \""); | sb.append("-keypass \""); | ||||
| if (null != keypass) { | if (null != keypass) { | ||||
| @@ -377,26 +377,26 @@ public class GenerateKey extends Task { | |||||
| sb.append("-sigalg \""); | sb.append("-sigalg \""); | ||||
| sb.append(sigalg); | sb.append(sigalg); | ||||
| sb.append("\" "); | sb.append("\" "); | ||||
| } | |||||
| } | |||||
| if (null != keyalg) { | if (null != keyalg) { | ||||
| sb.append("-keyalg \""); | sb.append("-keyalg \""); | ||||
| sb.append(keyalg); | sb.append(keyalg); | ||||
| sb.append("\" "); | sb.append("\" "); | ||||
| } | |||||
| } | |||||
| if (0 < keysize) { | if (0 < keysize) { | ||||
| sb.append("-keysize \""); | sb.append("-keysize \""); | ||||
| sb.append(keysize); | sb.append(keysize); | ||||
| sb.append("\" "); | sb.append("\" "); | ||||
| } | |||||
| } | |||||
| if (0 < validity) { | if (0 < validity) { | ||||
| sb.append("-validity \""); | sb.append("-validity \""); | ||||
| sb.append(validity); | sb.append(validity); | ||||
| sb.append("\" "); | sb.append("\" "); | ||||
| } | |||||
| } | |||||
| log("Generating Key for " + alias); | log("Generating Key for " + alias); | ||||
| final ExecTask cmd = (ExecTask) getProject().createTask("exec"); | final ExecTask cmd = (ExecTask) getProject().createTask("exec"); | ||||
| @@ -406,6 +406,6 @@ public class GenerateKey extends Task { | |||||
| cmd.setFailonerror(true); | cmd.setFailonerror(true); | ||||
| cmd.setTaskName(getTaskName()); | cmd.setTaskName(getTaskName()); | ||||
| cmd.execute(); | cmd.execute(); | ||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -148,7 +148,7 @@ public class Get extends Task { | |||||
| try { | try { | ||||
| Object encoder = | Object encoder = | ||||
| Class.forName("sun.misc.BASE64Encoder").newInstance(); | Class.forName("sun.misc.BASE64Encoder").newInstance(); | ||||
| encoding = (String) | |||||
| encoding = (String) | |||||
| encoder.getClass().getMethod("encode", new Class[] {byte[].class}) | encoder.getClass().getMethod("encode", new Class[] {byte[].class}) | ||||
| .invoke(encoder, new Object[] {up.getBytes()}); | .invoke(encoder, new Object[] {up.getBytes()}); | ||||
| @@ -67,7 +67,7 @@ import java.util.Vector; | |||||
| * Task to import another build file into the current project. | * Task to import another build file into the current project. | ||||
| * <p> | * <p> | ||||
| * It must be 'top level'. On execution it will read another Ant file | * It must be 'top level'. On execution it will read another Ant file | ||||
| * into the same Project. | |||||
| * into the same Project. | |||||
| * <p> | * <p> | ||||
| * <b>Important</b>: there is one limitation related to the top level | * <b>Important</b>: there is one limitation related to the top level | ||||
| * elements in the imported files. The current implementation will | * elements in the imported files. The current implementation will | ||||
| @@ -77,7 +77,7 @@ import java.util.Vector; | |||||
| * <b>Important</b>: we have not finalized how relative file references | * <b>Important</b>: we have not finalized how relative file references | ||||
| * will be resolved in deep/complex build hierarchies -such as what happens | * will be resolved in deep/complex build hierarchies -such as what happens | ||||
| * when an imported file imports another file. Use absolute references for | * 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 | * Examples | ||||
| * <pre> | * <pre> | ||||
| @@ -109,7 +109,7 @@ public class ImportTask extends Task { | |||||
| // for relative paths. | // for relative paths. | ||||
| this.file=file; | this.file=file; | ||||
| } | } | ||||
| /** | /** | ||||
| * This relies on the task order model. | * This relies on the task order model. | ||||
| * | * | ||||
| @@ -137,7 +137,7 @@ public class Input extends Task { | |||||
| * @exception BuildException | * @exception BuildException | ||||
| */ | */ | ||||
| public void execute () throws BuildException { | public void execute () throws BuildException { | ||||
| if (addproperty != null | |||||
| if (addproperty != null | |||||
| && getProject().getProperty(addproperty) != null) { | && getProject().getProperty(addproperty) != null) { | ||||
| log("skipping " + getTaskName() + " as property " + addproperty | log("skipping " + getTaskName() + " as property " + addproperty | ||||
| + " has already been set."); | + " has already been set."); | ||||
| @@ -154,7 +154,7 @@ public class Input extends Task { | |||||
| getProject().getInputHandler().handleInput(request); | getProject().getInputHandler().handleInput(request); | ||||
| String value = request.getInput(); | String value = request.getInput(); | ||||
| if ((value == null || value.trim().length() == 0) | |||||
| if ((value == null || value.trim().length() == 0) | |||||
| && defaultvalue != null) { | && defaultvalue != null) { | ||||
| value = defaultvalue; | value = defaultvalue; | ||||
| } | } | ||||
| @@ -104,7 +104,7 @@ public class Jar extends Zip { | |||||
| /** merged manifests added through filesets */ | /** merged manifests added through filesets */ | ||||
| private Manifest filesetManifest; | private Manifest filesetManifest; | ||||
| /** | |||||
| /** | |||||
| * Manifest of original archive, will be set to null if not in | * Manifest of original archive, will be set to null if not in | ||||
| * update mode. | * update mode. | ||||
| */ | */ | ||||
| @@ -127,7 +127,7 @@ public class Jar extends Zip { | |||||
| /** The encoding to use when reading in a manifest file */ | /** The encoding to use when reading in a manifest file */ | ||||
| private String manifestEncoding; | private String manifestEncoding; | ||||
| /** | /** | ||||
| * The file found from the 'manifest' attribute. This can be | * The file found from the 'manifest' attribute. This can be | ||||
| * either the location of a manifest, or the name of a jar added | * 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 */ | /** jar index is JDK 1.3+ only */ | ||||
| private boolean index = false; | private boolean index = false; | ||||
| /** | |||||
| /** | |||||
| * whether to really create the archive in createEmptyZip, will | * whether to really create the archive in createEmptyZip, will | ||||
| * get set in getResourcesToAdd. | * get set in getResourcesToAdd. | ||||
| */ | */ | ||||
| @@ -270,7 +270,7 @@ public class Jar extends Zip { | |||||
| ZipFile zf = null; | ZipFile zf = null; | ||||
| try { | try { | ||||
| zf = new ZipFile(jarFile); | zf = new ZipFile(jarFile); | ||||
| // must not use getEntry as "well behaving" applications | // must not use getEntry as "well behaving" applications | ||||
| // must accept the manifest in any capitalization | // must accept the manifest in any capitalization | ||||
| Enumeration enum = zf.entries(); | Enumeration enum = zf.entries(); | ||||
| @@ -522,7 +522,7 @@ public class Jar extends Zip { | |||||
| manifest = getManifest(file); | manifest = getManifest(file); | ||||
| } | } | ||||
| } catch (UnsupportedEncodingException e) { | } catch (UnsupportedEncodingException e) { | ||||
| throw new BuildException("Unsupported encoding while reading " | |||||
| throw new BuildException("Unsupported encoding while reading " | |||||
| + "manifest: " + e.getMessage(), e); | + "manifest: " + e.getMessage(), e); | ||||
| } | } | ||||
| } else if (filesetManifestConfig != null && | } else if (filesetManifestConfig != null && | ||||
| @@ -551,7 +551,7 @@ public class Jar extends Zip { | |||||
| filesetManifest.merge(newManifest); | filesetManifest.merge(newManifest); | ||||
| } | } | ||||
| } catch (UnsupportedEncodingException e) { | } catch (UnsupportedEncodingException e) { | ||||
| throw new BuildException("Unsupported encoding while reading " | |||||
| throw new BuildException("Unsupported encoding while reading " | |||||
| + "manifest: " + e.getMessage(), e); | + "manifest: " + e.getMessage(), e); | ||||
| } catch (ManifestException e) { | } catch (ManifestException e) { | ||||
| log("Manifest in file " + file + " is invalid: " | log("Manifest in file " + file + " is invalid: " | ||||
| @@ -617,7 +617,7 @@ public class Jar extends Zip { | |||||
| } else { | } else { | ||||
| Manifest mf = createManifest(); | Manifest mf = createManifest(); | ||||
| if (!mf.equals(originalManifest)) { | if (!mf.equals(originalManifest)) { | ||||
| log("Updating jar since jar manifest has changed", | |||||
| log("Updating jar since jar manifest has changed", | |||||
| Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
| needsUpdate = true; | needsUpdate = true; | ||||
| } | } | ||||
| @@ -641,10 +641,10 @@ public class Jar extends Zip { | |||||
| if (!createEmpty) { | if (!createEmpty) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| ZipOutputStream zOut = null; | ZipOutputStream zOut = null; | ||||
| try { | try { | ||||
| log("Building MANIFEST-only jar: " | |||||
| log("Building MANIFEST-only jar: " | |||||
| + getDestFile().getAbsolutePath()); | + getDestFile().getAbsolutePath()); | ||||
| zOut = new ZipOutputStream(new FileOutputStream(getDestFile())); | zOut = new ZipOutputStream(new FileOutputStream(getDestFile())); | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * 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. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * 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 | * the same JVM for the called application thus resulting in much | ||||
| * faster operation. | * faster operation. | ||||
| * | * | ||||
| * @author Stefano Mazzocchi | |||||
| * @author Stefano Mazzocchi | |||||
| * <a href="mailto:stefano@apache.org">stefano@apache.org</a> | * <a href="mailto:stefano@apache.org">stefano@apache.org</a> | ||||
| * @author Stefan Bodewig | * @author Stefan Bodewig | ||||
| * @author <a href="mailto:donal@savvion.com">Donal Quinlan</a> | * @author <a href="mailto:donal@savvion.com">Donal Quinlan</a> | ||||
| @@ -102,7 +102,7 @@ public class Java extends Task { | |||||
| int err = -1; | int err = -1; | ||||
| try { | try { | ||||
| if ((err = executeJava()) != 0) { | |||||
| if ((err = executeJava()) != 0) { | |||||
| if (failOnError) { | if (failOnError) { | ||||
| throw new BuildException("Java returned: " + err, getLocation()); | throw new BuildException("Java returned: " + err, getLocation()); | ||||
| } else { | } else { | ||||
| @@ -136,11 +136,11 @@ public class Java extends Task { | |||||
| log(cmdl.describeCommand(), Project.MSG_VERBOSE); | log(cmdl.describeCommand(), Project.MSG_VERBOSE); | ||||
| } else { | } else { | ||||
| if (cmdl.getVmCommand().size() > 1) { | 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); | Project.MSG_WARN); | ||||
| } | } | ||||
| if (dir != null) { | if (dir != null) { | ||||
| log("Working directory ignored when same JVM is used.", | |||||
| log("Working directory ignored when same JVM is used.", | |||||
| Project.MSG_WARN); | Project.MSG_WARN); | ||||
| } | } | ||||
| @@ -150,14 +150,14 @@ public class Java extends Task { | |||||
| } | } | ||||
| if (cmdl.getBootclasspath() != null) { | if (cmdl.getBootclasspath() != null) { | ||||
| log("bootclasspath ignored when same JVM is used.", | |||||
| log("bootclasspath ignored when same JVM is used.", | |||||
| Project.MSG_WARN); | Project.MSG_WARN); | ||||
| } | } | ||||
| log("Running in same VM " + cmdl.describeJavaCommand(), | |||||
| log("Running in same VM " + cmdl.describeJavaCommand(), | |||||
| Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
| } | } | ||||
| try { | try { | ||||
| if (fork) { | if (fork) { | ||||
| return run(cmdl.getCommandline()); | return run(cmdl.getCommandline()); | ||||
| @@ -188,13 +188,13 @@ public class Java extends Task { | |||||
| /** | /** | ||||
| * Set the classpath to be used when running the Java class | * Set the classpath to be used when running the Java class | ||||
| * | |||||
| * | |||||
| * @param s an Ant Path object containing the classpath. | * @param s an Ant Path object containing the classpath. | ||||
| */ | */ | ||||
| public void setClasspath(Path s) { | public void setClasspath(Path s) { | ||||
| createClasspath().append(s); | createClasspath().append(s); | ||||
| } | } | ||||
| /** | /** | ||||
| * Adds a path to the classpath. | * Adds a path to the classpath. | ||||
| */ | */ | ||||
| @@ -267,9 +267,9 @@ public class Java extends Task { | |||||
| public void setResultProperty(String resultProperty) { | public void setResultProperty(String resultProperty) { | ||||
| this.resultProperty = 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 | * passed in value if appropriate | ||||
| */ | */ | ||||
| protected void maybeSetResultPropertyValue(int result) { | protected void maybeSetResultPropertyValue(int result) { | ||||
| @@ -278,7 +278,7 @@ public class Java extends Task { | |||||
| project.setNewProperty(resultProperty, res); | project.setNewProperty(resultProperty, res); | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * If true, execute in a new VM. | * If true, execute in a new VM. | ||||
| */ | */ | ||||
| @@ -295,7 +295,7 @@ public class Java extends Task { | |||||
| Project.MSG_WARN); | Project.MSG_WARN); | ||||
| cmdl.createVmArgument().setLine(s); | cmdl.createVmArgument().setLine(s); | ||||
| } | } | ||||
| /** | /** | ||||
| * Adds a JVM argument. | * Adds a JVM argument. | ||||
| */ | */ | ||||
| @@ -309,7 +309,7 @@ public class Java extends Task { | |||||
| public void setJvm(String s) { | public void setJvm(String s) { | ||||
| cmdl.setVm(s); | cmdl.setVm(s); | ||||
| } | } | ||||
| /** | /** | ||||
| * Adds a system property. | * Adds a system property. | ||||
| */ | */ | ||||
| @@ -363,7 +363,7 @@ public class Java extends Task { | |||||
| public void setInputString(String inputString) { | public void setInputString(String inputString) { | ||||
| redirector.setInputString(inputString); | redirector.setInputString(inputString); | ||||
| } | } | ||||
| /** | /** | ||||
| * Controls whether error output of exec is logged. This is only useful | * Controls whether error output of exec is logged. This is only useful | ||||
| * when output is being redirected and error output is desired in the | * 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) { | public void setLogError(boolean logError) { | ||||
| redirector.setLogError(logError); | redirector.setLogError(logError); | ||||
| } | } | ||||
| /** | /** | ||||
| * File the error stream of the process is redirected to. | * File the error stream of the process is redirected to. | ||||
| * | * | ||||
| @@ -414,7 +414,7 @@ public class Java extends Task { | |||||
| public void setJVMVersion(String value) { | public void setJVMVersion(String value) { | ||||
| cmdl.setVmversion(value); | cmdl.setVmversion(value); | ||||
| } | } | ||||
| /** | /** | ||||
| * Adds an environment variable. | * Adds an environment variable. | ||||
| * | * | ||||
| @@ -467,8 +467,8 @@ public class Java extends Task { | |||||
| super.handleOutput(line); | super.handleOutput(line); | ||||
| } | } | ||||
| } | } | ||||
| public int handleInput(byte[] buffer, int offset, int length) | |||||
| public int handleInput(byte[] buffer, int offset, int length) | |||||
| throws IOException { | throws IOException { | ||||
| if (redirector.getInputStream() != null) { | if (redirector.getInputStream() != null) { | ||||
| return redirector.handleInput(buffer, offset, length); | return redirector.handleInput(buffer, offset, length); | ||||
| @@ -489,7 +489,7 @@ public class Java extends Task { | |||||
| super.handleFlush(line); | super.handleFlush(line); | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Pass output sent to System.err to specified output file. | * Pass output sent to System.err to specified output file. | ||||
| * | * | ||||
| @@ -502,7 +502,7 @@ public class Java extends Task { | |||||
| super.handleErrorOutput(line); | super.handleErrorOutput(line); | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Pass output sent to System.err to specified output file. | * Pass output sent to System.err to specified output file. | ||||
| * | * | ||||
| @@ -515,7 +515,7 @@ public class Java extends Task { | |||||
| super.handleErrorOutput(line); | super.handleErrorOutput(line); | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Executes the given classname with the given arguments as it | * Executes the given classname with the given arguments as it | ||||
| * was a command line application. | * 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. | * Executes the given classname with the given arguments in a separate VM. | ||||
| */ | */ | ||||
| private int run(String[] command) throws BuildException { | private int run(String[] command) throws BuildException { | ||||
| Execute exe | |||||
| Execute exe | |||||
| = new Execute(redirector.createHandler(), createWatchdog()); | = new Execute(redirector.createHandler(), createWatchdog()); | ||||
| exe.setAntRun(getProject()); | exe.setAntRun(getProject()); | ||||
| if (dir == null) { | if (dir == null) { | ||||
| dir = getProject().getBaseDir(); | dir = getProject().getBaseDir(); | ||||
| } else if (!dir.exists() || !dir.isDirectory()) { | } else if (!dir.exists() || !dir.isDirectory()) { | ||||
| @@ -551,9 +551,9 @@ public class Java extends Task { | |||||
| + " is not a valid directory", | + " is not a valid directory", | ||||
| getLocation()); | getLocation()); | ||||
| } | } | ||||
| exe.setWorkingDirectory(dir); | exe.setWorkingDirectory(dir); | ||||
| String[] environment = env.getVariables(); | String[] environment = env.getVariables(); | ||||
| if (environment != null) { | if (environment != null) { | ||||
| for (int i = 0; i < environment.length; i++) { | for (int i = 0; i < environment.length; i++) { | ||||
| @@ -568,7 +568,7 @@ public class Java extends Task { | |||||
| try { | try { | ||||
| int rc = exe.execute(); | int rc = exe.execute(); | ||||
| if (exe.killedProcess()) { | if (exe.killedProcess()) { | ||||
| log("Timeout: killed the sub-process", Project.MSG_WARN); | |||||
| log("Timeout: killed the sub-process", Project.MSG_WARN); | |||||
| } | } | ||||
| redirector.complete(); | redirector.complete(); | ||||
| return rc; | return rc; | ||||
| @@ -1523,7 +1523,7 @@ public class Javadoc extends Task { | |||||
| log ("-linksource option not supported on JavaDoc < 1.4", | log ("-linksource option not supported on JavaDoc < 1.4", | ||||
| Project.MSG_VERBOSE); | 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", | log ("-breakiterator option not supported on JavaDoc < 1.4", | ||||
| Project.MSG_VERBOSE); | 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"); | ||||
| toExecute.createArgument().setValue(source); | toExecute.createArgument().setValue(source); | ||||
| } | } | ||||
| if (linksource && doclet == null) { | if (linksource && doclet == null) { | ||||
| toExecute.createArgument().setValue("-linksource"); | toExecute.createArgument().setValue("-linksource"); | ||||
| } | } | ||||
| @@ -86,9 +86,9 @@ public class Jikes { | |||||
| protected Jikes(JikesOutputParser jop, String command, Project project) { | protected Jikes(JikesOutputParser jop, String command, Project project) { | ||||
| super(); | 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"); | + "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."); | + "developers and is unmaintained."); | ||||
| System.err.println("Don\'t use it!"); | System.err.println("Don\'t use it!"); | ||||
| @@ -113,7 +113,7 @@ public class Jikes { | |||||
| // There have been reports that 300 files could be compiled | // There have been reports that 300 files could be compiled | ||||
| // so 250 is a conservative approach | // so 250 is a conservative approach | ||||
| if (myos.toLowerCase().indexOf("windows") >= 0 | |||||
| if (myos.toLowerCase().indexOf("windows") >= 0 | |||||
| && args.length > 250) { | && args.length > 250) { | ||||
| PrintWriter out = null; | PrintWriter out = null; | ||||
| try { | try { | ||||
| @@ -123,10 +123,10 @@ public class Jikes { | |||||
| out.println(args[i]); | out.println(args[i]); | ||||
| } | } | ||||
| out.flush(); | out.flush(); | ||||
| commandArray = new String[] { command, | |||||
| commandArray = new String[] { command, | |||||
| "@" + tmpFile.getAbsolutePath()}; | "@" + tmpFile.getAbsolutePath()}; | ||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| throw new BuildException("Error creating temporary file", | |||||
| throw new BuildException("Error creating temporary file", | |||||
| e); | e); | ||||
| } finally { | } finally { | ||||
| if (out != null) { | if (out != null) { | ||||
| @@ -138,7 +138,7 @@ public class Jikes { | |||||
| commandArray[0] = command; | commandArray[0] = command; | ||||
| System.arraycopy(args, 0, commandArray, 1, args.length); | System.arraycopy(args, 0, commandArray, 1, args.length); | ||||
| } | } | ||||
| // We assume, that everything jikes writes goes to | // We assume, that everything jikes writes goes to | ||||
| // standard output, not to standard error. The option | // standard output, not to standard error. The option | ||||
| // -Xstdout that is given to Jikes in Javac.doJikesCompile() | // -Xstdout that is given to Jikes in Javac.doJikesCompile() | ||||
| @@ -80,7 +80,7 @@ public class JikesOutputParser implements ExecuteStreamHandler { | |||||
| protected int warnings; | protected int warnings; | ||||
| protected boolean error = false; | protected boolean error = false; | ||||
| protected boolean emacsMode; | protected boolean emacsMode; | ||||
| protected BufferedReader br; | protected BufferedReader br; | ||||
| /** | /** | ||||
| @@ -119,9 +119,9 @@ public class JikesOutputParser implements ExecuteStreamHandler { | |||||
| protected JikesOutputParser(Task task, boolean emacsMode) { | protected JikesOutputParser(Task task, boolean emacsMode) { | ||||
| super(); | 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"); | + "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."); | + "developers and is unmaintained."); | ||||
| System.err.println("Don\'t use it!"); | System.err.println("Don\'t use it!"); | ||||
| @@ -145,9 +145,9 @@ public class JikesOutputParser implements ExecuteStreamHandler { | |||||
| String line; | String line; | ||||
| String lower; | String lower; | ||||
| // We assume, that every output, jike does, stands for an error/warning | // We assume, that every output, jike does, stands for an error/warning | ||||
| // XXX | |||||
| // XXX | |||||
| // Is this correct? | // Is this correct? | ||||
| // TODO: | // TODO: | ||||
| // A warning line, that shows code, which contains a variable | // A warning line, that shows code, which contains a variable | ||||
| // error will cause some trouble. The parser should definitely | // error will cause some trouble. The parser should definitely | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * 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. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * 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. | * Keyword substitution. Input file is written to output file. | ||||
| * Do not make input file same as 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. | * setKeys method to understand how to do the substitutions. | ||||
| * | * | ||||
| * @author Jon S. Stevens <a href="mailto:jon@clearink.com">jon@clearink.com</a> | * @author Jon S. Stevens <a href="mailto:jon@clearink.com">jon@clearink.com</a> | ||||
| @@ -81,7 +81,7 @@ public class KeySubst extends Task { | |||||
| private File dest = null; | private File dest = null; | ||||
| private String sep = "*"; | private String sep = "*"; | ||||
| private Hashtable replacements = new Hashtable(); | private Hashtable replacements = new Hashtable(); | ||||
| /** | /** | ||||
| Do the execution. | Do the execution. | ||||
| */ | */ | ||||
| @@ -90,7 +90,7 @@ public class KeySubst extends Task { | |||||
| log("Performing Substitions"); | log("Performing Substitions"); | ||||
| if (source == null || dest == null) { | if (source == null || dest == null) { | ||||
| log("Source and destinations must not be null"); | log("Source and destinations must not be null"); | ||||
| return; | |||||
| return; | |||||
| } | } | ||||
| BufferedReader br = null; | BufferedReader br = null; | ||||
| BufferedWriter bw = null; | BufferedWriter bw = null; | ||||
| @@ -152,7 +152,7 @@ public class KeySubst extends Task { | |||||
| } | } | ||||
| /** | /** | ||||
| * Sets the keys. | * Sets the keys. | ||||
| * | |||||
| * | |||||
| Format string is like this: | Format string is like this: | ||||
| <p> | <p> | ||||
| name=value*name2=value | name=value*name2=value | ||||
| @@ -170,21 +170,21 @@ public class KeySubst extends Task { | |||||
| String token = tok.nextToken().trim(); | String token = tok.nextToken().trim(); | ||||
| StringTokenizer itok = | StringTokenizer itok = | ||||
| new StringTokenizer(token, "=", false); | new StringTokenizer(token, "=", false); | ||||
| String name = itok.nextToken(); | String name = itok.nextToken(); | ||||
| String value = itok.nextToken(); | String value = itok.nextToken(); | ||||
| replacements.put(name, value); | replacements.put(name, value); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| public static void main(String[] args) { | public static void main(String[] args) { | ||||
| try { | try { | ||||
| Hashtable hash = new Hashtable(); | Hashtable hash = new Hashtable(); | ||||
| hash.put("VERSION", "1.0.3"); | hash.put("VERSION", "1.0.3"); | ||||
| hash.put("b", "ffff"); | 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)); | hash)); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| e.printStackTrace(); | e.printStackTrace(); | ||||
| @@ -193,7 +193,7 @@ public class KeySubst extends Task { | |||||
| /** | /** | ||||
| Does replacement on text using the hashtable of keys. | Does replacement on text using the hashtable of keys. | ||||
| @return the string with the replacements in it. | @return the string with the replacements in it. | ||||
| */ | */ | ||||
| public static String replace(String origString, Hashtable keys) | public static String replace(String origString, Hashtable keys) | ||||
| @@ -203,7 +203,7 @@ public class KeySubst extends Task { | |||||
| int i = 0; | int i = 0; | ||||
| String key = null; | String key = null; | ||||
| while ((index = origString.indexOf("${", i)) > -1) { | while ((index = origString.indexOf("${", i)) > -1) { | ||||
| key = origString.substring(index + 2, origString.indexOf("}", | |||||
| key = origString.substring(index + 2, origString.indexOf("}", | |||||
| index + 3)); | index + 3)); | ||||
| finalString.append (origString.substring(i, index)); | finalString.append (origString.substring(i, index)); | ||||
| if (keys.containsKey(key)) { | if (keys.containsKey(key)) { | ||||
| @@ -189,7 +189,7 @@ public final class LoadFile extends Task { | |||||
| crh.setFilterChains(filterChains); | crh.setFilterChains(filterChains); | ||||
| crh.setProject(getProject()); | crh.setProject(getProject()); | ||||
| instream = crh.getAssembledReader(); | instream = crh.getAssembledReader(); | ||||
| text = crh.readFully(instream); | text = crh.readFully(instream); | ||||
| } | } | ||||
| @@ -110,12 +110,12 @@ public class LogOutputStream extends OutputStream { | |||||
| } | } | ||||
| /** | /** | ||||
| * Flush this log stream | |||||
| * Flush this log stream | |||||
| */ | */ | ||||
| public void flush() { | public void flush() { | ||||
| processBuffer(); | processBuffer(); | ||||
| } | } | ||||
| /** | /** | ||||
| * Converts the buffer to a string and sends it to <code>processLine</code> | * Converts the buffer to a string and sends it to <code>processLine</code> | ||||
| @@ -637,7 +637,7 @@ public class Manifest { | |||||
| while (e.hasMoreElements()) { | while (e.hasMoreElements()) { | ||||
| String key = (String) e.nextElement(); | String key = (String) e.nextElement(); | ||||
| Attribute attribute = getAttribute(key); | Attribute attribute = getAttribute(key); | ||||
| cloned.storeAttribute(new Attribute(attribute.getName(), | |||||
| cloned.storeAttribute(new Attribute(attribute.getName(), | |||||
| attribute.getValue())); | attribute.getValue())); | ||||
| } | } | ||||
| return cloned; | return cloned; | ||||
| @@ -729,9 +729,9 @@ public class Manifest { | |||||
| + defManifest); | + defManifest); | ||||
| } | } | ||||
| try { | try { | ||||
| Manifest defaultManifest | |||||
| Manifest defaultManifest | |||||
| = new Manifest(new InputStreamReader(in, "UTF-8")); | = 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.version") + " (" | ||||
| + System.getProperty("java.vm.vendor") + ")" ); | + System.getProperty("java.vm.vendor") + ")" ); | ||||
| defaultManifest.getMainSection().storeAttribute(createdBy); | defaultManifest.getMainSection().storeAttribute(createdBy); | ||||
| @@ -96,11 +96,11 @@ public class ManifestTask extends Task { | |||||
| */ | */ | ||||
| private Mode mode; | private Mode mode; | ||||
| /** | |||||
| /** | |||||
| * The encoding of the manifest file | * The encoding of the manifest file | ||||
| */ | */ | ||||
| private String encoding; | private String encoding; | ||||
| /** | /** | ||||
| * Helper class for Manifest's mode attribute. | * Helper class for Manifest's mode attribute. | ||||
| */ | */ | ||||
| @@ -410,7 +410,7 @@ public abstract class MatchingTask extends Task implements SelectorContainer { | |||||
| public void addDepend(DependSelector selector) { | public void addDepend(DependSelector selector) { | ||||
| fileset.addDepend(selector); | fileset.addDepend(selector); | ||||
| } | } | ||||
| /** | /** | ||||
| * add a regular expression selector entry on the selector list | * add a regular expression selector entry on the selector list | ||||
| */ | */ | ||||
| @@ -87,14 +87,14 @@ public class Mkdir extends Task { | |||||
| if (dir.isFile()) { | if (dir.isFile()) { | ||||
| throw new BuildException("Unable to create directory as a file " | throw new BuildException("Unable to create directory as a file " | ||||
| + "already exists with that name: " | |||||
| + "already exists with that name: " | |||||
| + dir.getAbsolutePath()); | + dir.getAbsolutePath()); | ||||
| } | } | ||||
| if (!dir.exists()) { | if (!dir.exists()) { | ||||
| boolean result = dir.mkdirs(); | boolean result = dir.mkdirs(); | ||||
| if (!result) { | if (!result) { | ||||
| String msg = "Directory " + dir.getAbsolutePath() | |||||
| String msg = "Directory " + dir.getAbsolutePath() | |||||
| + " creation was not successful for an unknown reason"; | + " creation was not successful for an unknown reason"; | ||||
| throw new BuildException(msg, getLocation()); | throw new BuildException(msg, getLocation()); | ||||
| } | } | ||||
| @@ -66,14 +66,14 @@ import org.apache.tools.ant.util.StringUtils; | |||||
| * Executes the contained tasks in separate threads, continuing | * Executes the contained tasks in separate threads, continuing | ||||
| * once all are completed. | * once all are completed. | ||||
| * <p> | * <p> | ||||
| * New behavior allows for the ant script to specify a maximum number of | |||||
| * New behavior allows for the ant script to specify a maximum number of | |||||
| * threads that will be executed in parallel. One should be very careful about | * threads that will be executed in parallel. One should be very careful about | ||||
| * using the <code>waitFor</code> task when specifying <code>threadCount</code> | * using the <code>waitFor</code> task when specifying <code>threadCount</code> | ||||
| * as it can cause deadlocks if the number of threads is too small or if one of | |||||
| * the nested tasks fails to execute completely. The task selection algorithm | |||||
| * will insure that the tasks listed before a task have started before that | |||||
| * task is started, but it will not insure a successful completion of those | |||||
| * tasks or that those tasks will finish first (i.e. it's a classic race | |||||
| * as it can cause deadlocks if the number of threads is too small or if one of | |||||
| * the nested tasks fails to execute completely. The task selection algorithm | |||||
| * will insure that the tasks listed before a task have started before that | |||||
| * task is started, but it will not insure a successful completion of those | |||||
| * tasks or that those tasks will finish first (i.e. it's a classic race | |||||
| * condition). | * condition). | ||||
| * </p> | * </p> | ||||
| * @author Thomas Christen <a href="mailto:chr@active.ch">chr@active.ch</a> | * @author Thomas Christen <a href="mailto:chr@active.ch">chr@active.ch</a> | ||||
| @@ -91,13 +91,13 @@ public class Parallel extends Task | |||||
| /** Semaphore to notify of completed threads */ | /** Semaphore to notify of completed threads */ | ||||
| private final Object semaphore = new Object(); | private final Object semaphore = new Object(); | ||||
| /** Total number of threads to run */ | /** Total number of threads to run */ | ||||
| private int numThreads = 0; | private int numThreads = 0; | ||||
| /** Total number of threads per processor to run. */ | /** Total number of threads per processor to run. */ | ||||
| private int numThreadsPerProcessor = 0; | private int numThreadsPerProcessor = 0; | ||||
| /** Interval (in ms) to poll for finished threads. */ | /** Interval (in ms) to poll for finished threads. */ | ||||
| private int pollInterval = 1000; // default is once a second | private int pollInterval = 1000; // default is once a second | ||||
| @@ -108,28 +108,28 @@ public class Parallel extends Task | |||||
| public void addTask(Task nestedTask) { | public void addTask(Task nestedTask) { | ||||
| nestedTasks.addElement(nestedTask); | nestedTasks.addElement(nestedTask); | ||||
| } | } | ||||
| /** | |||||
| * Dynamically generates the number of threads to execute based on the | |||||
| * number of available processors (via | |||||
| * <code>java.lang.Runtime.availableProcessors()</code>). Requires a J2SE | |||||
| * 1.4 VM, and it will overwrite the value set in threadCount. | |||||
| * If used in a 1.1, 1.2, or 1.3 VM then the task will defer to | |||||
| /** | |||||
| * Dynamically generates the number of threads to execute based on the | |||||
| * number of available processors (via | |||||
| * <code>java.lang.Runtime.availableProcessors()</code>). Requires a J2SE | |||||
| * 1.4 VM, and it will overwrite the value set in threadCount. | |||||
| * If used in a 1.1, 1.2, or 1.3 VM then the task will defer to | |||||
| * <code>threadCount</code>.; optional | * <code>threadCount</code>.; optional | ||||
| * @param numThreadsPerProcessor Number of threads to create per available | |||||
| * @param numThreadsPerProcessor Number of threads to create per available | |||||
| * processor. | * processor. | ||||
| * | * | ||||
| */ | */ | ||||
| public void setThreadsPerProcessor(int numThreadsPerProcessor) { | public void setThreadsPerProcessor(int numThreadsPerProcessor) { | ||||
| this.numThreadsPerProcessor = numThreadsPerProcessor; | this.numThreadsPerProcessor = numThreadsPerProcessor; | ||||
| } | } | ||||
| /** | |||||
| * Statically determine the maximum number of tasks to execute | |||||
| * simultaneously. If there are less tasks than threads then all will be | |||||
| * executed at once, if there are more then only <code>threadCount</code> | |||||
| * tasks will be executed at one time. If <code>threadsPerProcessor</code> | |||||
| * is set and the JVM is at least a 1.4 VM then this value is | |||||
| /** | |||||
| * Statically determine the maximum number of tasks to execute | |||||
| * simultaneously. If there are less tasks than threads then all will be | |||||
| * executed at once, if there are more then only <code>threadCount</code> | |||||
| * tasks will be executed at one time. If <code>threadsPerProcessor</code> | |||||
| * is set and the JVM is at least a 1.4 VM then this value is | |||||
| * ignored.; optional | * ignored.; optional | ||||
| * | * | ||||
| * @param numThreads total number of therads. | * @param numThreads total number of therads. | ||||
| @@ -139,8 +139,8 @@ public class Parallel extends Task | |||||
| this.numThreads = numThreads; | 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 | * threadsPerProcessor is specified. Integer in milliseconds.; optional | ||||
| * | * | ||||
| * @param pollInterval New value of property pollInterval. | * @param pollInterval New value of property pollInterval. | ||||
| @@ -148,7 +148,7 @@ public class Parallel extends Task | |||||
| public void setPollInterval(int pollInterval) { | public void setPollInterval(int pollInterval) { | ||||
| this.pollInterval = pollInterval; | this.pollInterval = pollInterval; | ||||
| } | } | ||||
| /** | /** | ||||
| * Execute the parallel tasks | * Execute the parallel tasks | ||||
| * | * | ||||
| @@ -161,7 +161,7 @@ public class Parallel extends Task | |||||
| } | } | ||||
| spinThreads(); | spinThreads(); | ||||
| } | } | ||||
| /** | /** | ||||
| * Determine the number of threads based on the number of processors | * 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. | * 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]; | Thread[] threads = new Thread[numTasks]; | ||||
| TaskRunnable[] runnables = new TaskRunnable[numTasks]; | TaskRunnable[] runnables = new TaskRunnable[numTasks]; | ||||
| int threadNumber = 0; | int threadNumber = 0; | ||||
| for (Enumeration e = nestedTasks.elements(); e.hasMoreElements(); | |||||
| for (Enumeration e = nestedTasks.elements(); e.hasMoreElements(); | |||||
| threadNumber++) { | threadNumber++) { | ||||
| Task nestedTask = (Task) e.nextElement(); | Task nestedTask = (Task) e.nextElement(); | ||||
| ThreadGroup group = new ThreadGroup("parallel"); | ThreadGroup group = new ThreadGroup("parallel"); | ||||
| TaskRunnable taskRunnable | |||||
| TaskRunnable taskRunnable | |||||
| = new TaskRunnable(threadNumber, nestedTask); | = new TaskRunnable(threadNumber, nestedTask); | ||||
| runnables[threadNumber] = taskRunnable; | runnables[threadNumber] = taskRunnable; | ||||
| threads[threadNumber] = new Thread(group, taskRunnable); | threads[threadNumber] = new Thread(group, taskRunnable); | ||||
| @@ -197,7 +197,7 @@ public class Parallel extends Task | |||||
| final int maxRunning = numThreads; | final int maxRunning = numThreads; | ||||
| Thread[] running = new Thread[maxRunning]; | Thread[] running = new Thread[maxRunning]; | ||||
| threadNumber = 0; | threadNumber = 0; | ||||
| // now run them in limited numbers... | // now run them in limited numbers... | ||||
| outer: | outer: | ||||
| while (threadNumber < numTasks) { | while (threadNumber < numTasks) { | ||||
| @@ -206,7 +206,7 @@ public class Parallel extends Task | |||||
| if (running[i] == null || !running[i].isAlive()) { | if (running[i] == null || !running[i].isAlive()) { | ||||
| running[i] = threads[threadNumber++]; | running[i] = threads[threadNumber++]; | ||||
| running[i].start(); | running[i].start(); | ||||
| // countinue on outer while loop in case we | |||||
| // countinue on outer while loop in case we | |||||
| // used our last thread | // used our last thread | ||||
| continue outer; | 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) { | for (int i = 0; i < maxRunning; ++i) { | ||||
| try { | try { | ||||
| if (running[i] != null) { | if (running[i] != null) { | ||||
| @@ -232,7 +232,7 @@ public class Parallel extends Task | |||||
| // who would interrupt me at a time like this? | // who would interrupt me at a time like this? | ||||
| } | } | ||||
| } | } | ||||
| // now did any of the threads throw an exception | // now did any of the threads throw an exception | ||||
| StringBuffer exceptionMessage = new StringBuffer(); | StringBuffer exceptionMessage = new StringBuffer(); | ||||
| int numExceptions = 0; | int numExceptions = 0; | ||||
| @@ -245,7 +245,7 @@ public class Parallel extends Task | |||||
| if (firstException == null) { | if (firstException == null) { | ||||
| firstException = t; | firstException = t; | ||||
| } | } | ||||
| if (t instanceof BuildException && | |||||
| if (t instanceof BuildException && | |||||
| firstLocation == Location.UNKNOWN_LOCATION) { | firstLocation == Location.UNKNOWN_LOCATION) { | ||||
| firstLocation = ((BuildException) t).getLocation(); | firstLocation = ((BuildException) t).getLocation(); | ||||
| } | } | ||||
| @@ -253,7 +253,7 @@ public class Parallel extends Task | |||||
| exceptionMessage.append(t.getMessage()); | exceptionMessage.append(t.getMessage()); | ||||
| } | } | ||||
| } | } | ||||
| if (numExceptions == 1) { | if (numExceptions == 1) { | ||||
| if (firstException instanceof BuildException) { | if (firstException instanceof BuildException) { | ||||
| throw (BuildException) firstException; | throw (BuildException) firstException; | ||||
| @@ -261,11 +261,11 @@ public class Parallel extends Task | |||||
| throw new BuildException(firstException); | throw new BuildException(firstException); | ||||
| } | } | ||||
| } else if (numExceptions > 1) { | } else if (numExceptions > 1) { | ||||
| throw new BuildException(exceptionMessage.toString(), | |||||
| throw new BuildException(exceptionMessage.toString(), | |||||
| firstLocation); | firstLocation); | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Determine the number of processors. Only effective on later VMs | * Determine the number of processors. Only effective on later VMs | ||||
| * | * | ||||
| @@ -328,5 +328,5 @@ public class Parallel extends Task | |||||
| return exception; | return exception; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -90,7 +90,7 @@ public class Patch extends Task { | |||||
| */ | */ | ||||
| public void setPatchfile(File file) { | public void setPatchfile(File file) { | ||||
| if (!file.exists()) { | if (!file.exists()) { | ||||
| throw new BuildException("patchfile " + file + " doesn\'t exist", | |||||
| throw new BuildException("patchfile " + file + " doesn\'t exist", | |||||
| getLocation()); | getLocation()); | ||||
| } | } | ||||
| cmd.createArgument().setValue("-i"); | cmd.createArgument().setValue("-i"); | ||||
| @@ -165,9 +165,9 @@ public class Patch extends Task { | |||||
| */ | */ | ||||
| public void execute() throws BuildException { | public void execute() throws BuildException { | ||||
| if (!havePatchfile) { | if (!havePatchfile) { | ||||
| throw new BuildException("patchfile argument is required", | |||||
| throw new BuildException("patchfile argument is required", | |||||
| getLocation()); | getLocation()); | ||||
| } | |||||
| } | |||||
| Commandline toExecute = (Commandline) cmd.clone(); | Commandline toExecute = (Commandline) cmd.clone(); | ||||
| toExecute.setExecutable("patch"); | toExecute.setExecutable("patch"); | ||||
| @@ -176,7 +176,7 @@ public class Patch extends Task { | |||||
| } | } | ||||
| Execute exe = new Execute(new LogStreamHandler(this, Project.MSG_INFO, | Execute exe = new Execute(new LogStreamHandler(this, Project.MSG_INFO, | ||||
| Project.MSG_WARN), | |||||
| Project.MSG_WARN), | |||||
| null); | null); | ||||
| exe.setCommandline(toExecute.getCommandline()); | exe.setCommandline(toExecute.getCommandline()); | ||||
| @@ -237,7 +237,7 @@ public class PathConvert extends Task { | |||||
| /** | /** | ||||
| * Set targetos to a platform to one of | * Set targetos to a platform to one of | ||||
| * "windows", "unix", "netware", or "os/2". | * "windows", "unix", "netware", or "os/2". | ||||
| * | |||||
| * | |||||
| * Required unless unless pathsep and/or dirsep are specified. | * Required unless unless pathsep and/or dirsep are specified. | ||||
| * | * | ||||
| * @deprecated use the method taking a TargetOs argument instead | * @deprecated use the method taking a TargetOs argument instead | ||||
| @@ -74,14 +74,14 @@ class ProcessDestroyer | |||||
| private Method addShutdownHookMethod; | private Method addShutdownHookMethod; | ||||
| private Method removeShutdownHookMethod; | private Method removeShutdownHookMethod; | ||||
| private ProcessDestroyerImpl destroyProcessThread = null; | private ProcessDestroyerImpl destroyProcessThread = null; | ||||
| // whether or not this ProcessDestroyer has been registered as a | // whether or not this ProcessDestroyer has been registered as a | ||||
| // shutdown hook | // shutdown hook | ||||
| private boolean added = false; | private boolean added = false; | ||||
| private class ProcessDestroyerImpl extends Thread{ | private class ProcessDestroyerImpl extends Thread{ | ||||
| private boolean shouldDestroy = true; | private boolean shouldDestroy = true; | ||||
| public ProcessDestroyerImpl(){ | public ProcessDestroyerImpl(){ | ||||
| super("ProcessDestroyer Shutdown Hook"); | super("ProcessDestroyer Shutdown Hook"); | ||||
| } | } | ||||
| @@ -90,30 +90,30 @@ class ProcessDestroyer | |||||
| ProcessDestroyer.this.run(); | ProcessDestroyer.this.run(); | ||||
| } | } | ||||
| } | } | ||||
| public void setShouldDestroy(boolean shouldDestroy){ | public void setShouldDestroy(boolean shouldDestroy){ | ||||
| this.shouldDestroy = shouldDestroy; | this.shouldDestroy = shouldDestroy; | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Constructs a <code>ProcessDestroyer</code> and obtains | |||||
| * <code>Runtime.addShutdownHook()</code> and | |||||
| * <code>Runtime.removeShutdownHook()</code> through reflection. The | |||||
| * ProcessDestroyer manages a list of processes to be destroyed when the | |||||
| * VM exits. If a process is added when the list is empty, | |||||
| * this <code>ProcessDestroyer</code> is registered as a shutdown hook. If | |||||
| * Constructs a <code>ProcessDestroyer</code> and obtains | |||||
| * <code>Runtime.addShutdownHook()</code> and | |||||
| * <code>Runtime.removeShutdownHook()</code> through reflection. The | |||||
| * ProcessDestroyer manages a list of processes to be destroyed when the | |||||
| * VM exits. If a process is added when the list is empty, | |||||
| * this <code>ProcessDestroyer</code> is registered as a shutdown hook. If | |||||
| * removing a process results in an empty list, the | * removing a process results in an empty list, the | ||||
| * <code>ProcessDestroyer</code> is removed as a shutdown hook. | * <code>ProcessDestroyer</code> is removed as a shutdown hook. | ||||
| */ | */ | ||||
| public ProcessDestroyer() { | public ProcessDestroyer() { | ||||
| try { | 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) | // (support pre-JDK 1.3 VMs) | ||||
| Class[] paramTypes = {Thread.class}; | Class[] paramTypes = {Thread.class}; | ||||
| addShutdownHookMethod = | addShutdownHookMethod = | ||||
| Runtime.class.getMethod("addShutdownHook", paramTypes); | Runtime.class.getMethod("addShutdownHook", paramTypes); | ||||
| removeShutdownHookMethod = | removeShutdownHookMethod = | ||||
| Runtime.class.getMethod("removeShutdownHook", paramTypes); | Runtime.class.getMethod("removeShutdownHook", paramTypes); | ||||
| // wait to add shutdown hook as needed | // wait to add shutdown hook as needed | ||||
| @@ -121,9 +121,9 @@ class ProcessDestroyer | |||||
| // it just won't be added as a shutdown hook... :( | // it just won't be added as a shutdown hook... :( | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Registers this <code>ProcessDestroyer</code> as a shutdown hook, | |||||
| * Registers this <code>ProcessDestroyer</code> as a shutdown hook, | |||||
| * uses reflection to ensure pre-JDK 1.3 compatibility. | * uses reflection to ensure pre-JDK 1.3 compatibility. | ||||
| */ | */ | ||||
| private void addShutdownHook(){ | private void addShutdownHook(){ | ||||
| @@ -140,7 +140,7 @@ class ProcessDestroyer | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Registers this <code>ProcessDestroyer</code> as a shutdown hook, | * Registers this <code>ProcessDestroyer</code> as a shutdown hook, | ||||
| * uses reflection to ensure pre-JDK 1.3 compatibility | * uses reflection to ensure pre-JDK 1.3 compatibility | ||||
| @@ -161,7 +161,7 @@ class ProcessDestroyer | |||||
| destroyProcessThread.setShouldDestroy(false); | destroyProcessThread.setShouldDestroy(false); | ||||
| destroyProcessThread.start(); | destroyProcessThread.start(); | ||||
| // this should return quickly, since Process.destroy() | // this should return quickly, since Process.destroy() | ||||
| try{ | |||||
| try{ | |||||
| destroyProcessThread.join(20000); | destroyProcessThread.join(20000); | ||||
| }catch(InterruptedException ie){ | }catch(InterruptedException ie){ | ||||
| // the thread didn't die in time | // 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 | * as shutdown hook | ||||
| * @return true if this is currently added as shutdown hook | * @return true if this is currently added as shutdown hook | ||||
| */ | */ | ||||
| public boolean isAddedAsShutdownHook(){ | public boolean isAddedAsShutdownHook(){ | ||||
| return added; | return added; | ||||
| } | } | ||||
| /** | /** | ||||
| * Returns <code>true</code> if the specified <code>Process</code> was | * Returns <code>true</code> if the specified <code>Process</code> was | ||||
| * successfully added to the list of processes to destroy upon VM exit. | * successfully added to the list of processes to destroy upon VM exit. | ||||
| * | |||||
| * | |||||
| * @param process the process to add | * @param process the process to add | ||||
| * @return <code>true</code> if the specified <code>Process</code> was | * @return <code>true</code> if the specified <code>Process</code> was | ||||
| * successfully added | * successfully added | ||||
| */ | */ | ||||
| public boolean add(Process process) { | public boolean add(Process process) { | ||||
| synchronized(processes){ | synchronized(processes){ | ||||
| // if this list is empty, register the shutdown hook | |||||
| // if this list is empty, register the shutdown hook | |||||
| if(processes.size() == 0){ | if(processes.size() == 0){ | ||||
| addShutdownHook(); | addShutdownHook(); | ||||
| } | } | ||||
| @@ -76,8 +76,8 @@ public class PumpStreamHandler implements ExecuteStreamHandler { | |||||
| private OutputStream out; | private OutputStream out; | ||||
| private OutputStream err; | private OutputStream err; | ||||
| private InputStream input; | private InputStream input; | ||||
| public PumpStreamHandler(OutputStream out, OutputStream err, | |||||
| public PumpStreamHandler(OutputStream out, OutputStream err, | |||||
| InputStream input) { | InputStream input) { | ||||
| this.out = out; | this.out = out; | ||||
| this.err = err; | this.err = err; | ||||
| @@ -116,7 +116,7 @@ public class PumpStreamHandler implements ExecuteStreamHandler { | |||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| //ignore | //ignore | ||||
| } | } | ||||
| } | |||||
| } | |||||
| } | } | ||||
| public void start() { | public void start() { | ||||
| @@ -144,7 +144,7 @@ public class PumpStreamHandler implements ExecuteStreamHandler { | |||||
| inputThread.join(); | inputThread.join(); | ||||
| } catch (InterruptedException e) { | } catch (InterruptedException e) { | ||||
| // ignore | // ignore | ||||
| } | |||||
| } | |||||
| } | } | ||||
| try { | try { | ||||
| @@ -188,9 +188,9 @@ public class PumpStreamHandler implements ExecuteStreamHandler { | |||||
| * Creates a stream pumper to copy the given input stream to the | * Creates a stream pumper to copy the given input stream to the | ||||
| * given output stream. | * given output stream. | ||||
| */ | */ | ||||
| protected Thread createPump(InputStream is, OutputStream os, | |||||
| protected Thread createPump(InputStream is, OutputStream os, | |||||
| boolean closeWhenExhausted) { | boolean closeWhenExhausted) { | ||||
| final Thread result | |||||
| final Thread result | |||||
| = new Thread(new StreamPumper(is, os, closeWhenExhausted)); | = new Thread(new StreamPumper(is, os, closeWhenExhausted)); | ||||
| result.setDaemon(true); | result.setDaemon(true); | ||||
| return result; | return result; | ||||
| @@ -78,11 +78,11 @@ import org.apache.tools.ant.util.StringUtils; | |||||
| /** | /** | ||||
| * Replaces all occurrences of one or more string tokens with given | * 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. | * or the value of a property available in a designated property file. | ||||
| * If you want to replace a text that crosses line boundaries, you | * If you want to replace a text that crosses line boundaries, you | ||||
| * must use a nested <code><replacetoken></code> element. | * must use a nested <code><replacetoken></code> element. | ||||
| * @author Stefano Mazzocchi | |||||
| * @author Stefano Mazzocchi | |||||
| * <a href="mailto:stefano@apache.org">stefano@apache.org</a> | * <a href="mailto:stefano@apache.org">stefano@apache.org</a> | ||||
| * @author <a href="mailto:erik@desknetinc.com">Erik Langenbach</a> | * @author <a href="mailto:erik@desknetinc.com">Erik Langenbach</a> | ||||
| * | * | ||||
| @@ -91,7 +91,7 @@ import org.apache.tools.ant.util.StringUtils; | |||||
| * @ant.task category="filesystem" | * @ant.task category="filesystem" | ||||
| */ | */ | ||||
| public class Replace extends MatchingTask { | public class Replace extends MatchingTask { | ||||
| private File src = null; | private File src = null; | ||||
| private NestedString token = null; | private NestedString token = null; | ||||
| private NestedString value = new NestedString(); | private NestedString value = new NestedString(); | ||||
| @@ -104,12 +104,12 @@ public class Replace extends MatchingTask { | |||||
| private File dir = null; | private File dir = null; | ||||
| private int fileCount; | private int fileCount; | ||||
| private int replaceCount; | |||||
| private int replaceCount; | |||||
| private boolean summary = false; | private boolean summary = false; | ||||
| /** The encoding used to read and write files - if null, uses default */ | /** The encoding used to read and write files - if null, uses default */ | ||||
| private String encoding = null; | private String encoding = null; | ||||
| private FileUtils fileUtils = FileUtils.newFileUtils(); | private FileUtils fileUtils = FileUtils.newFileUtils(); | ||||
| /** | /** | ||||
| @@ -143,7 +143,7 @@ public class Replace extends MatchingTask { | |||||
| public void validate() throws BuildException { | public void validate() throws BuildException { | ||||
| //Validate mandatory attributes | //Validate mandatory attributes | ||||
| if (token == null) { | if (token == null) { | ||||
| String message = "token is a mandatory attribute " | |||||
| String message = "token is a mandatory attribute " | |||||
| + "of replacefilter."; | + "of replacefilter."; | ||||
| throw new BuildException(message); | throw new BuildException(message); | ||||
| } | } | ||||
| @@ -156,8 +156,8 @@ public class Replace extends MatchingTask { | |||||
| //value and property are mutually exclusive attributes | //value and property are mutually exclusive attributes | ||||
| if ((value != null) && (property != null)) { | 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."; | + "element cannot have both."; | ||||
| throw new BuildException(message); | throw new BuildException(message); | ||||
| } | } | ||||
| @@ -174,7 +174,7 @@ public class Replace extends MatchingTask { | |||||
| //Make sure property exists in property file | //Make sure property exists in property file | ||||
| if (properties == null || | if (properties == null || | ||||
| properties.getProperty(property) == null) { | properties.getProperty(property) == null) { | ||||
| String message = "property \"" + property | |||||
| String message = "property \"" + property | |||||
| + "\" was not found in " + propertyFile.getPath(); | + "\" was not found in " + propertyFile.getPath(); | ||||
| throw new BuildException(message); | throw new BuildException(message); | ||||
| } | } | ||||
| @@ -256,7 +256,7 @@ public class Replace extends MatchingTask { | |||||
| public void execute() throws BuildException { | public void execute() throws BuildException { | ||||
| Vector savedFilters = (Vector) replacefilters.clone(); | Vector savedFilters = (Vector) replacefilters.clone(); | ||||
| Properties savedProperties = | |||||
| Properties savedProperties = | |||||
| properties == null ? null : (Properties) properties.clone(); | properties == null ? null : (Properties) properties.clone(); | ||||
| try { | try { | ||||
| @@ -270,42 +270,42 @@ public class Replace extends MatchingTask { | |||||
| replaceFilter.setValue(props.getProperty(token)); | replaceFilter.setValue(props.getProperty(token)); | ||||
| } | } | ||||
| } | } | ||||
| validateAttributes(); | validateAttributes(); | ||||
| if (propertyFile != null) { | if (propertyFile != null) { | ||||
| properties = getProperties(propertyFile); | properties = getProperties(propertyFile); | ||||
| } | } | ||||
| validateReplacefilters(); | validateReplacefilters(); | ||||
| fileCount = 0; | fileCount = 0; | ||||
| replaceCount = 0; | replaceCount = 0; | ||||
| if (src != null) { | if (src != null) { | ||||
| processFile(src); | processFile(src); | ||||
| } | } | ||||
| if (dir != null) { | if (dir != null) { | ||||
| DirectoryScanner ds = super.getDirectoryScanner(dir); | DirectoryScanner ds = super.getDirectoryScanner(dir); | ||||
| String[] srcs = ds.getIncludedFiles(); | String[] srcs = ds.getIncludedFiles(); | ||||
| for (int i = 0; i < srcs.length; i++) { | for (int i = 0; i < srcs.length; i++) { | ||||
| File file = new File(dir, srcs[i]); | File file = new File(dir, srcs[i]); | ||||
| processFile(file); | processFile(file); | ||||
| } | } | ||||
| } | } | ||||
| if (summary) { | if (summary) { | ||||
| log("Replaced " + replaceCount + " occurrences in " | |||||
| log("Replaced " + replaceCount + " occurrences in " | |||||
| + fileCount + " files.", Project.MSG_INFO); | + fileCount + " files.", Project.MSG_INFO); | ||||
| } | } | ||||
| } finally { | } finally { | ||||
| replacefilters = savedFilters; | replacefilters = savedFilters; | ||||
| properties = savedProperties; | properties = savedProperties; | ||||
| } // end of finally | } // end of finally | ||||
| } | } | ||||
| /** | /** | ||||
| * Validate attributes provided for this task in .xml build file. | * Validate attributes provided for this task in .xml build file. | ||||
| * | * | ||||
| @@ -314,12 +314,12 @@ public class Replace extends MatchingTask { | |||||
| */ | */ | ||||
| public void validateAttributes() throws BuildException { | public void validateAttributes() throws BuildException { | ||||
| if (src == null && dir == null) { | 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"; | + "must be specified"; | ||||
| throw new BuildException(message, getLocation()); | throw new BuildException(message, getLocation()); | ||||
| } | } | ||||
| if (propertyFile != null && !propertyFile.exists()) { | if (propertyFile != null && !propertyFile.exists()) { | ||||
| String message = "Property file " + propertyFile.getPath() | |||||
| String message = "Property file " + propertyFile.getPath() | |||||
| + " does not exist."; | + " does not exist."; | ||||
| throw new BuildException(message, getLocation()); | throw new BuildException(message, getLocation()); | ||||
| } | } | ||||
| @@ -343,7 +343,7 @@ public class Replace extends MatchingTask { | |||||
| public void validateReplacefilters() | public void validateReplacefilters() | ||||
| throws BuildException { | throws BuildException { | ||||
| for (int i = 0; i < replacefilters.size(); i++) { | for (int i = 0; i < replacefilters.size(); i++) { | ||||
| Replacefilter element = | |||||
| Replacefilter element = | |||||
| (Replacefilter) replacefilters.elementAt(i); | (Replacefilter) replacefilters.elementAt(i); | ||||
| element.validate(); | element.validate(); | ||||
| } | } | ||||
| @@ -362,11 +362,11 @@ public class Replace extends MatchingTask { | |||||
| try { | try { | ||||
| properties.load(new FileInputStream(propertyFile)); | properties.load(new FileInputStream(propertyFile)); | ||||
| } catch (FileNotFoundException e) { | } catch (FileNotFoundException e) { | ||||
| String message = "Property file (" + propertyFile.getPath() | |||||
| String message = "Property file (" + propertyFile.getPath() | |||||
| + ") not found."; | + ") not found."; | ||||
| throw new BuildException(message); | throw new BuildException(message); | ||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| String message = "Property file (" + propertyFile.getPath() | |||||
| String message = "Property file (" + propertyFile.getPath() | |||||
| + ") cannot be loaded."; | + ") cannot be loaded."; | ||||
| throw new BuildException(message); | throw new BuildException(message); | ||||
| } | } | ||||
| @@ -384,11 +384,11 @@ public class Replace extends MatchingTask { | |||||
| */ | */ | ||||
| private void processFile(File src) throws BuildException { | private void processFile(File src) throws BuildException { | ||||
| if (!src.exists()) { | if (!src.exists()) { | ||||
| throw new BuildException("Replace: source file " + src.getPath() | |||||
| throw new BuildException("Replace: source file " + src.getPath() | |||||
| + " doesn't exist", getLocation()); | + " doesn't exist", getLocation()); | ||||
| } | } | ||||
| File temp = fileUtils.createTempFile("rep", ".tmp", | |||||
| File temp = fileUtils.createTempFile("rep", ".tmp", | |||||
| fileUtils.getParentFile(src)); | fileUtils.getParentFile(src)); | ||||
| Reader reader = null; | Reader reader = null; | ||||
| @@ -398,7 +398,7 @@ public class Replace extends MatchingTask { | |||||
| : new InputStreamReader(new FileInputStream(src), encoding); | : new InputStreamReader(new FileInputStream(src), encoding); | ||||
| writer = encoding == null ? new FileWriter(temp) | writer = encoding == null ? new FileWriter(temp) | ||||
| : new OutputStreamWriter(new FileOutputStream(temp), encoding); | : new OutputStreamWriter(new FileOutputStream(temp), encoding); | ||||
| BufferedReader br = new BufferedReader(reader); | BufferedReader br = new BufferedReader(reader); | ||||
| BufferedWriter bw = new BufferedWriter(writer); | BufferedWriter bw = new BufferedWriter(writer); | ||||
| @@ -418,9 +418,9 @@ public class Replace extends MatchingTask { | |||||
| StringUtils.LINE_SEP, false); | StringUtils.LINE_SEP, false); | ||||
| String tok = stringReplace(token.getText(), "\n", | String tok = stringReplace(token.getText(), "\n", | ||||
| StringUtils.LINE_SEP, false); | StringUtils.LINE_SEP, false); | ||||
| // for each found token, replace with value | // 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); | + " --> " + value.getText(), Project.MSG_VERBOSE); | ||||
| newString = stringReplace(newString, tok, val, true); | newString = stringReplace(newString, tok, val, true); | ||||
| } | } | ||||
| @@ -449,8 +449,8 @@ public class Replace extends MatchingTask { | |||||
| temp = null; | temp = null; | ||||
| } | } | ||||
| } catch (IOException ioe) { | } 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()); | + ioe.getMessage(), ioe, getLocation()); | ||||
| } finally { | } finally { | ||||
| if (reader != null) { | if (reader != null) { | ||||
| @@ -467,7 +467,7 @@ public class Replace extends MatchingTask { | |||||
| temp.delete(); | temp.delete(); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| @@ -483,9 +483,9 @@ public class Replace extends MatchingTask { | |||||
| Replacefilter filter = (Replacefilter) replacefilters.elementAt(i); | Replacefilter filter = (Replacefilter) replacefilters.elementAt(i); | ||||
| //for each found token, replace with value | //for each found token, replace with value | ||||
| log("Replacing in " + filename + ": " + filter.getToken() | |||||
| log("Replacing in " + filename + ": " + filter.getToken() | |||||
| + " --> " + filter.getReplaceValue(), Project.MSG_VERBOSE); | + " --> " + filter.getReplaceValue(), Project.MSG_VERBOSE); | ||||
| newString = stringReplace(newString, filter.getToken(), | |||||
| newString = stringReplace(newString, filter.getToken(), | |||||
| filter.getReplaceValue(), true); | filter.getReplaceValue(), true); | ||||
| } | } | ||||
| @@ -512,8 +512,8 @@ public class Replace extends MatchingTask { | |||||
| public void setSummary(boolean summary) { | public void setSummary(boolean summary) { | ||||
| this.summary = summary; | this.summary = summary; | ||||
| } | } | ||||
| /** | /** | ||||
| * Sets the name of a property file containing filters; optional. | * Sets the name of a property file containing filters; optional. | ||||
| * Each property will be treated as a | * Each property will be treated as a | ||||
| @@ -563,7 +563,7 @@ public class Replace extends MatchingTask { | |||||
| public void setEncoding(String encoding) { | public void setEncoding(String encoding) { | ||||
| this.encoding = encoding; | this.encoding = encoding; | ||||
| } | } | ||||
| /** | /** | ||||
| * the token to filter as the text of a nested element | * the token to filter as the text of a nested element | ||||
| * @return nested token to configure | * @return nested token to configure | ||||
| @@ -605,7 +605,7 @@ public class Replace extends MatchingTask { | |||||
| /** | /** | ||||
| * Replace occurrences of str1 in string str with str2 | * Replace occurrences of str1 in string str with str2 | ||||
| */ | |||||
| */ | |||||
| private String stringReplace(String str, String str1, String str2, | private String stringReplace(String str, String str1, String str2, | ||||
| boolean countReplaces) { | boolean countReplaces) { | ||||
| StringBuffer ret = new StringBuffer(); | StringBuffer ret = new StringBuffer(); | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * 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. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * 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. | * Executes a series of SQL statements on a database using JDBC. | ||||
| * | * | ||||
| * <p>Statements can | * <p>Statements can | ||||
| * either be read in from a text file using the <i>src</i> attribute or from | |||||
| * either be read in from a text file using the <i>src</i> attribute or from | |||||
| * between the enclosing SQL tags.</p> | * between the enclosing SQL tags.</p> | ||||
| * | |||||
| * <p>Multiple statements can be provided, separated by semicolons (or the | |||||
| * defined <i>delimiter</i>). Individual lines within the statements can be | |||||
| * | |||||
| * <p>Multiple statements can be provided, separated by semicolons (or the | |||||
| * defined <i>delimiter</i>). Individual lines within the statements can be | |||||
| * commented using either --, // or REM at the start of the line.</p> | * commented using either --, // or REM at the start of the line.</p> | ||||
| * | |||||
| * <p>The <i>autocommit</i> attribute specifies whether auto-commit should be | |||||
| * turned on or off whilst executing the statements. If auto-commit is turned | |||||
| * on each statement will be executed and committed. If it is turned off the | |||||
| * | |||||
| * <p>The <i>autocommit</i> attribute specifies whether auto-commit should be | |||||
| * turned on or off whilst executing the statements. If auto-commit is turned | |||||
| * on each statement will be executed and committed. If it is turned off the | |||||
| * statements will all be executed as one transaction.</p> | * statements will all be executed as one transaction.</p> | ||||
| * | |||||
| * <p>The <i>onerror</i> attribute specifies how to proceed when an error occurs | |||||
| * during the execution of one of the statements. | |||||
| * | |||||
| * <p>The <i>onerror</i> attribute specifies how to proceed when an error occurs | |||||
| * during the execution of one of the statements. | |||||
| * The possible values are: <b>continue</b> execution, only show the error; | * The possible values are: <b>continue</b> execution, only show the error; | ||||
| * <b>stop</b> execution and commit transaction; | * <b>stop</b> execution and commit transaction; | ||||
| * and <b>abort</b> execution and transaction and fail task.</p> | * and <b>abort</b> execution and transaction and fail task.</p> | ||||
| * | |||||
| * | |||||
| * @author <a href="mailto:jeff@custommonkey.org">Jeff Martin</a> | * @author <a href="mailto:jeff@custommonkey.org">Jeff Martin</a> | ||||
| * @author <A href="mailto:gholam@xtra.co.nz">Michael McCallum</A> | * @author <A href="mailto:gholam@xtra.co.nz">Michael McCallum</A> | ||||
| * @author <A href="mailto:tim.stephenson@sybase.com">Tim Stephenson</A> | * @author <A href="mailto:tim.stephenson@sybase.com">Tim Stephenson</A> | ||||
| @@ -126,8 +126,8 @@ public class SQLExec extends JDBCTask { | |||||
| } | } | ||||
| } | } | ||||
| private int goodSql = 0; | private int goodSql = 0; | ||||
| private int totalSql = 0; | private int totalSql = 0; | ||||
| @@ -166,13 +166,13 @@ public class SQLExec extends JDBCTask { | |||||
| * SQL Statement delimiter | * SQL Statement delimiter | ||||
| */ | */ | ||||
| private String delimiter = ";"; | private String delimiter = ";"; | ||||
| /** | /** | ||||
| * The delimiter type indicating whether the delimiter will | * The delimiter type indicating whether the delimiter will | ||||
| * only be recognized on a line by itself | * only be recognized on a line by itself | ||||
| */ | */ | ||||
| private String delimiterType = DelimiterType.NORMAL; | private String delimiterType = DelimiterType.NORMAL; | ||||
| /** | /** | ||||
| * Print SQL results. | * Print SQL results. | ||||
| */ | */ | ||||
| @@ -188,12 +188,12 @@ public class SQLExec extends JDBCTask { | |||||
| */ | */ | ||||
| private File output = null; | private File output = null; | ||||
| /** | /** | ||||
| * Action to perform if an error is found | * Action to perform if an error is found | ||||
| **/ | **/ | ||||
| private String onError = "abort"; | private String onError = "abort"; | ||||
| /** | /** | ||||
| * Encoding to use when reading SQL statements from a file | * 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? | * Append to an existing file or overwrite it? | ||||
| */ | */ | ||||
| private boolean append = false; | private boolean append = false; | ||||
| /** | /** | ||||
| * Keep the format of a sql block? | * Keep the format of a sql block? | ||||
| */ | */ | ||||
| @@ -223,15 +223,15 @@ public class SQLExec extends JDBCTask { | |||||
| public void setSrc(File srcFile) { | public void setSrc(File srcFile) { | ||||
| this.srcFile = 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. | * NB: Properties are not expanded in this text. | ||||
| */ | */ | ||||
| public void addText(String sql) { | public void addText(String sql) { | ||||
| this.sqlCommand += sql; | this.sqlCommand += sql; | ||||
| } | } | ||||
| /** | /** | ||||
| * Adds a set of files (nested fileset attribute). | * Adds a set of files (nested fileset attribute). | ||||
| */ | */ | ||||
| @@ -248,7 +248,7 @@ public class SQLExec extends JDBCTask { | |||||
| transactions.addElement(t); | transactions.addElement(t); | ||||
| return t; | return t; | ||||
| } | } | ||||
| /** | /** | ||||
| * Set the file encoding to use on the SQL files read in | * 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) { | public void setEncoding(String encoding) { | ||||
| this.encoding = encoding; | this.encoding = encoding; | ||||
| } | } | ||||
| /** | /** | ||||
| * Set the delimiter that separates SQL statements. Defaults to ";"; | |||||
| * Set the delimiter that separates SQL statements. Defaults to ";"; | |||||
| * optional | * optional | ||||
| * | * | ||||
| * <p>For example, set this to "go" and delimitertype to "ROW" for | * <p>For example, set this to "go" and delimitertype to "ROW" for | ||||
| @@ -280,7 +280,7 @@ public class SQLExec extends JDBCTask { | |||||
| public void setDelimiterType(DelimiterType delimiterType) { | public void setDelimiterType(DelimiterType delimiterType) { | ||||
| this.delimiterType = delimiterType.getValue(); | this.delimiterType = delimiterType.getValue(); | ||||
| } | } | ||||
| /** | /** | ||||
| * Print result sets from the statements; | * Print result sets from the statements; | ||||
| * optional, default false | * optional, default false | ||||
| @@ -288,9 +288,9 @@ public class SQLExec extends JDBCTask { | |||||
| public void setPrint(boolean print) { | public void setPrint(boolean print) { | ||||
| this.print = print; | this.print = print; | ||||
| } | } | ||||
| /** | /** | ||||
| * Print headers for result sets from the | |||||
| * Print headers for result sets from the | |||||
| * statements; optional, default true. | * statements; optional, default true. | ||||
| */ | */ | ||||
| public void setShowheaders(boolean showheaders) { | 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. | * optional, defaults to the Ant log. | ||||
| */ | */ | ||||
| public void setOutput(File output) { | public void setOutput(File output) { | ||||
| @@ -315,7 +315,7 @@ public class SQLExec extends JDBCTask { | |||||
| this.append = append; | this.append = append; | ||||
| } | } | ||||
| /** | /** | ||||
| * Action to perform when statement fails: continue, stop, or abort | * Action to perform when statement fails: continue, stop, or abort | ||||
| * optional; default "abort" | * optional; default "abort" | ||||
| @@ -327,13 +327,13 @@ public class SQLExec extends JDBCTask { | |||||
| /** | /** | ||||
| * whether or not format should be preserved. | * whether or not format should be preserved. | ||||
| * Defaults to false. | * Defaults to false. | ||||
| * | |||||
| * | |||||
| * @param keepformat The keepformat to set | * @param keepformat The keepformat to set | ||||
| */ | */ | ||||
| public void setKeepformat(boolean keepformat) { | public void setKeepformat(boolean keepformat) { | ||||
| this.keepformat = keepformat; | this.keepformat = keepformat; | ||||
| } | } | ||||
| /** | /** | ||||
| * Set escape processing for statements. | * Set escape processing for statements. | ||||
| * | * | ||||
| @@ -353,15 +353,15 @@ public class SQLExec extends JDBCTask { | |||||
| sqlCommand = sqlCommand.trim(); | sqlCommand = sqlCommand.trim(); | ||||
| try { | try { | ||||
| if (srcFile == null && sqlCommand.length() == 0 | |||||
| && filesets.isEmpty()) { | |||||
| if (srcFile == null && sqlCommand.length() == 0 | |||||
| && filesets.isEmpty()) { | |||||
| if (transactions.size() == 0) { | if (transactions.size() == 0) { | ||||
| throw new BuildException("Source file or fileset, " | throw new BuildException("Source file or fileset, " | ||||
| + "transactions or sql statement " | + "transactions or sql statement " | ||||
| + "must be set!", location); | + "must be set!", location); | ||||
| } | } | ||||
| } | } | ||||
| if (srcFile != null && !srcFile.exists()) { | if (srcFile != null && !srcFile.exists()) { | ||||
| throw new BuildException("Source file does not exist!", location); | throw new BuildException("Source file does not exist!", location); | ||||
| } | } | ||||
| @@ -371,16 +371,16 @@ public class SQLExec extends JDBCTask { | |||||
| FileSet fs = (FileSet) filesets.elementAt(i); | FileSet fs = (FileSet) filesets.elementAt(i); | ||||
| DirectoryScanner ds = fs.getDirectoryScanner(project); | DirectoryScanner ds = fs.getDirectoryScanner(project); | ||||
| File srcDir = fs.getDir(project); | File srcDir = fs.getDir(project); | ||||
| String[] srcFiles = ds.getIncludedFiles(); | String[] srcFiles = ds.getIncludedFiles(); | ||||
| // Make a transaction for each file | // Make a transaction for each file | ||||
| for (int j = 0 ; j < srcFiles.length ; j++) { | for (int j = 0 ; j < srcFiles.length ; j++) { | ||||
| Transaction t = createTransaction(); | Transaction t = createTransaction(); | ||||
| t.setSrc(new File(srcDir, srcFiles[j])); | t.setSrc(new File(srcDir, srcFiles[j])); | ||||
| } | } | ||||
| } | } | ||||
| // Make a transaction group for the outer command | // Make a transaction group for the outer command | ||||
| Transaction t = createTransaction(); | Transaction t = createTransaction(); | ||||
| t.setSrc(srcFile); | t.setSrc(srcFile); | ||||
| @@ -392,11 +392,11 @@ public class SQLExec extends JDBCTask { | |||||
| try { | try { | ||||
| statement = conn.createStatement(); | statement = conn.createStatement(); | ||||
| statement.setEscapeProcessing(escapeProcessing); | statement.setEscapeProcessing(escapeProcessing); | ||||
| PrintStream out = System.out; | PrintStream out = System.out; | ||||
| try { | try { | ||||
| if (output != null) { | if (output != null) { | ||||
| log("Opening PrintStream to output file " + output, | |||||
| log("Opening PrintStream to output file " + output, | |||||
| Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
| out = new PrintStream( | out = new PrintStream( | ||||
| new BufferedOutputStream( | new BufferedOutputStream( | ||||
| @@ -404,11 +404,11 @@ public class SQLExec extends JDBCTask { | |||||
| .getAbsolutePath(), | .getAbsolutePath(), | ||||
| append))); | append))); | ||||
| } | } | ||||
| // Process all transactions | // Process all transactions | ||||
| for (Enumeration e = transactions.elements(); | |||||
| for (Enumeration e = transactions.elements(); | |||||
| e.hasMoreElements();) { | e.hasMoreElements();) { | ||||
| ((Transaction) e.nextElement()).runTransaction(out); | ((Transaction) e.nextElement()).runTransaction(out); | ||||
| if (!isAutocommit()) { | if (!isAutocommit()) { | ||||
| log("Commiting transaction", Project.MSG_VERBOSE); | log("Commiting transaction", Project.MSG_VERBOSE); | ||||
| @@ -419,7 +419,7 @@ public class SQLExec extends JDBCTask { | |||||
| if (out != null && out != System.out) { | if (out != null && out != System.out) { | ||||
| out.close(); | out.close(); | ||||
| } | } | ||||
| } | |||||
| } | |||||
| } catch (IOException e){ | } catch (IOException e){ | ||||
| if (!isAutocommit() && conn != null && onError.equals("abort")) { | if (!isAutocommit() && conn != null && onError.equals("abort")) { | ||||
| try { | try { | ||||
| @@ -444,8 +444,8 @@ public class SQLExec extends JDBCTask { | |||||
| } | } | ||||
| } catch (SQLException e) {} | } catch (SQLException e) {} | ||||
| } | } | ||||
| log(goodSql + " of " + totalSql + | |||||
| log(goodSql + " of " + totalSql + | |||||
| " SQL statements executed successfully"); | " SQL statements executed successfully"); | ||||
| } finally { | } finally { | ||||
| transactions = savedTransaction; | transactions = savedTransaction; | ||||
| @@ -456,13 +456,13 @@ public class SQLExec extends JDBCTask { | |||||
| /** | /** | ||||
| * read in lines and execute them | * read in lines and execute them | ||||
| */ | */ | ||||
| protected void runStatements(Reader reader, PrintStream out) | |||||
| protected void runStatements(Reader reader, PrintStream out) | |||||
| throws SQLException, IOException { | throws SQLException, IOException { | ||||
| StringBuffer sql = new StringBuffer(); | StringBuffer sql = new StringBuffer(); | ||||
| String line = ""; | String line = ""; | ||||
| BufferedReader in = new BufferedReader(reader); | BufferedReader in = new BufferedReader(reader); | ||||
| while ((line = in.readLine()) != null){ | while ((line = in.readLine()) != null){ | ||||
| if (!keepformat) { | if (!keepformat) { | ||||
| line = line.trim(); | line = line.trim(); | ||||
| @@ -483,13 +483,13 @@ public class SQLExec extends JDBCTask { | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if (!keepformat) { | if (!keepformat) { | ||||
| sql.append(" " + line); | sql.append(" " + line); | ||||
| } else { | } else { | ||||
| sql.append("\n" + line); | sql.append("\n" + line); | ||||
| } | } | ||||
| // SQL defines "--" as a comment to EOL | // SQL defines "--" as a comment to EOL | ||||
| // and in Oracle it may contain a hint | // and in Oracle it may contain a hint | ||||
| // so we cannot just remove it, instead we must end it | // so we cannot just remove it, instead we must end it | ||||
| @@ -498,12 +498,12 @@ public class SQLExec extends JDBCTask { | |||||
| sql.append("\n"); | 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))) { | && line.equals(delimiter))) { | ||||
| execSQL(sql.substring(0, sql.length() - delimiter.length()), | |||||
| execSQL(sql.substring(0, sql.length() - delimiter.length()), | |||||
| out); | out); | ||||
| sql.replace(0, sql.length(), ""); | sql.replace(0, sql.length(), ""); | ||||
| } | } | ||||
| @@ -513,8 +513,8 @@ public class SQLExec extends JDBCTask { | |||||
| execSQL(sql.toString(), out); | execSQL(sql.toString(), out); | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Exec the sql statement. | * Exec the sql statement. | ||||
| */ | */ | ||||
| @@ -523,19 +523,19 @@ public class SQLExec extends JDBCTask { | |||||
| if ("".equals(sql.trim())) { | if ("".equals(sql.trim())) { | ||||
| return; | return; | ||||
| } | } | ||||
| try { | |||||
| try { | |||||
| totalSql++; | totalSql++; | ||||
| log("SQL: " + sql, Project.MSG_VERBOSE); | log("SQL: " + sql, Project.MSG_VERBOSE); | ||||
| if (!statement.execute(sql)) { | if (!statement.execute(sql)) { | ||||
| log(statement.getUpdateCount() + " rows affected", | |||||
| log(statement.getUpdateCount() + " rows affected", | |||||
| Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
| } else { | } else { | ||||
| if (print) { | if (print) { | ||||
| printResults(out); | printResults(out); | ||||
| } | } | ||||
| } | } | ||||
| SQLWarning warning = conn.getWarnings(); | SQLWarning warning = conn.getWarnings(); | ||||
| while (warning != null){ | while (warning != null){ | ||||
| log(warning + " sql warning", Project.MSG_VERBOSE); | log(warning + " sql warning", Project.MSG_VERBOSE); | ||||
| @@ -551,7 +551,7 @@ public class SQLExec extends JDBCTask { | |||||
| log(e.toString(), Project.MSG_ERR); | log(e.toString(), Project.MSG_ERR); | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * print any results in the statement. | * print any results in the statement. | ||||
| */ | */ | ||||
| @@ -580,7 +580,7 @@ public class SQLExec extends JDBCTask { | |||||
| if (columnValue != null) { | if (columnValue != null) { | ||||
| columnValue = columnValue.trim(); | columnValue = columnValue.trim(); | ||||
| } | } | ||||
| if (first) { | if (first) { | ||||
| first = false; | first = false; | ||||
| } else { | } else { | ||||
| @@ -634,20 +634,20 @@ public class SQLExec extends JDBCTask { | |||||
| /** | /** | ||||
| * | * | ||||
| */ | */ | ||||
| private void runTransaction(PrintStream out) | |||||
| private void runTransaction(PrintStream out) | |||||
| throws IOException, SQLException { | throws IOException, SQLException { | ||||
| if (tSqlCommand.length() != 0) { | if (tSqlCommand.length() != 0) { | ||||
| log("Executing commands", Project.MSG_INFO); | log("Executing commands", Project.MSG_INFO); | ||||
| runStatements(new StringReader(tSqlCommand), out); | runStatements(new StringReader(tSqlCommand), out); | ||||
| } | } | ||||
| if (tSrcFile != null) { | if (tSrcFile != null) { | ||||
| log("Executing file: " + tSrcFile.getAbsolutePath(), | |||||
| log("Executing file: " + tSrcFile.getAbsolutePath(), | |||||
| Project.MSG_INFO); | Project.MSG_INFO); | ||||
| Reader reader = | |||||
| Reader reader = | |||||
| (encoding == null) ? new FileReader(tSrcFile) | (encoding == null) ? new FileReader(tSrcFile) | ||||
| : new InputStreamReader( | : new InputStreamReader( | ||||
| new FileInputStream(tSrcFile), | |||||
| new FileInputStream(tSrcFile), | |||||
| encoding); | encoding); | ||||
| try { | try { | ||||
| runStatements(reader, out); | runStatements(reader, out); | ||||
| @@ -57,12 +57,12 @@ package org.apache.tools.ant.taskdefs; | |||||
| import org.apache.tools.ant.taskdefs.email.EmailTask; | 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 | * This task can send mail using either plain | ||||
| * text, UU encoding or Mime format mail depending on what is available. | * text, UU encoding or Mime format mail depending on what is available. | ||||
| * Attachments may be sent using nested FileSet | * Attachments may be sent using nested FileSet | ||||
| * elements. | * elements. | ||||
| * @author glenn_twiggs@bmc.com | * @author glenn_twiggs@bmc.com | ||||
| * @author Magesh Umasankar | * @author Magesh Umasankar | ||||
| * | * | ||||
| @@ -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 | * the sequential execution of a subset of tasks within the | ||||
| {@link Parallel Parallel Task} | |||||
| {@link Parallel Parallel Task} | |||||
| * <p> | * <p> | ||||
| * The sequential task has no attributes and does not support any nested | |||||
| * elements apart from Ant tasks. Any valid Ant task may be embedded within the | |||||
| * The sequential task has no attributes and does not support any nested | |||||
| * elements apart from Ant tasks. Any valid Ant task may be embedded within the | |||||
| * sequential task.</p> | * sequential task.</p> | ||||
| * @author Thomas Christen <a href="mailto:chr@active.ch">chr@active.ch</a> | * @author Thomas Christen <a href="mailto:chr@active.ch">chr@active.ch</a> | ||||
| * @since Ant 1.4 | * @since Ant 1.4 | ||||
| * @ant.task category="control" | * @ant.task category="control" | ||||
| @@ -245,7 +245,7 @@ public class SignJar extends Task { | |||||
| log("nested filesets will be ignored if the jar attribute has" | log("nested filesets will be ignored if the jar attribute has" | ||||
| + " been specified.", Project.MSG_WARN); | + " been specified.", Project.MSG_WARN); | ||||
| } | } | ||||
| doOneJar(jar, signedjar); | doOneJar(jar, signedjar); | ||||
| return; | return; | ||||
| } else { | } else { | ||||
| @@ -83,13 +83,13 @@ public class StreamPumper implements Runnable { | |||||
| * @param closeWhenExhausted if true, the output stream will be closed when | * @param closeWhenExhausted if true, the output stream will be closed when | ||||
| * the input is exhausted. | * the input is exhausted. | ||||
| */ | */ | ||||
| public StreamPumper(InputStream is, OutputStream os, | |||||
| public StreamPumper(InputStream is, OutputStream os, | |||||
| boolean closeWhenExhausted) { | boolean closeWhenExhausted) { | ||||
| this.is = is; | this.is = is; | ||||
| this.os = os; | this.os = os; | ||||
| this.closeWhenExhausted = closeWhenExhausted; | |||||
| this.closeWhenExhausted = closeWhenExhausted; | |||||
| } | } | ||||
| /** | /** | ||||
| * Create a new stream pumper. | * Create a new stream pumper. | ||||
| * | * | ||||
| @@ -163,7 +163,7 @@ public class Sync extends Task { | |||||
| log("Removed " + count + " " + what + " from " + toDir, | log("Removed " + count + " " + what + " from " + toDir, | ||||
| Project.MSG_INFO); | Project.MSG_INFO); | ||||
| } else { | } else { | ||||
| log("NO " + what + " to remove from " + toDir, | |||||
| log("NO " + what + " to remove from " + toDir, | |||||
| Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
| } | } | ||||
| } | } | ||||
| @@ -219,7 +219,7 @@ public class Tar extends MatchingTask { | |||||
| public void setCompression(TarCompressionMethod mode) { | public void setCompression(TarCompressionMethod mode) { | ||||
| this.compression = mode; | this.compression = mode; | ||||
| } | } | ||||
| /** | /** | ||||
| * do the business | * do the business | ||||
| */ | */ | ||||
| @@ -336,7 +336,7 @@ public class Tar extends MatchingTask { | |||||
| filesets = savedFileSets; | filesets = savedFileSets; | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * tar a file | * 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 | * optional, default=0644 | ||||
| */ | */ | ||||
| public void setMode(String octalString) { | public void setMode(String octalString) { | ||||
| this.fileMode = | |||||
| this.fileMode = | |||||
| UnixStat.FILE_FLAG | Integer.parseInt(octalString, 8); | 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 | * optional, default=0755 | ||||
| * | * | ||||
| * @since Ant 1.6 | * @since Ant 1.6 | ||||
| */ | */ | ||||
| public void setDirMode(String octalString) { | public void setDirMode(String octalString) { | ||||
| this.dirMode = | |||||
| this.dirMode = | |||||
| UnixStat.DIR_FLAG | Integer.parseInt(octalString, 8); | 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 | * This is not the same as the UID, which is | ||||
| * not currently set by the task. | * 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 | * @author Magesh Umasankar | ||||
| */ | */ | ||||
| @@ -77,7 +77,7 @@ import org.apache.tools.ant.util.JavaEnvUtils; | |||||
| * <p>Note: Setting the modification time of files is not supported in | * <p>Note: Setting the modification time of files is not supported in | ||||
| * JDK 1.1.</p> | * JDK 1.1.</p> | ||||
| * | * | ||||
| * @author Stefan Bodewig | |||||
| * @author Stefan Bodewig | |||||
| * @author <a href="mailto:mj@servidium.com">Michael J. Sikorsky</a> | * @author <a href="mailto:mj@servidium.com">Michael J. Sikorsky</a> | ||||
| * @author <a href="mailto:shaw@servidium.com">Robert Shaw</a> | * @author <a href="mailto:shaw@servidium.com">Robert Shaw</a> | ||||
| * | * | ||||
| @@ -87,7 +87,7 @@ import org.apache.tools.ant.util.JavaEnvUtils; | |||||
| */ | */ | ||||
| public class Touch extends Task { | public class Touch extends Task { | ||||
| private File file; | |||||
| private File file; | |||||
| private long millis = -1; | private long millis = -1; | ||||
| private String dateTime; | private String dateTime; | ||||
| private Vector filesets = new Vector(); | private Vector filesets = new Vector(); | ||||
| @@ -116,7 +116,7 @@ public class Touch extends Task { | |||||
| /** | /** | ||||
| * the new modification time of the file | * the new modification time of the file | ||||
| * in the format "MM/DD/YYYY HH:MM AM <i>or</i> PM" | |||||
| * in the format "MM/DD/YYYY HH:MM AM <i>or</i> PM" | |||||
| * or "MM/DD/YYYY HH:MM:SS AM <i>or</i> PM". | * or "MM/DD/YYYY HH:MM:SS AM <i>or</i> PM". | ||||
| * Optional, default=now | * Optional, default=now | ||||
| */ | */ | ||||
| @@ -138,7 +138,7 @@ public class Touch extends Task { | |||||
| long savedMillis = millis; | long savedMillis = millis; | ||||
| if (file == null && filesets.size() == 0) { | if (file == null && filesets.size() == 0) { | ||||
| throw | |||||
| throw | |||||
| new BuildException("Specify at least one source - a file or " | new BuildException("Specify at least one source - a file or " | ||||
| + "a fileset."); | + "a fileset."); | ||||
| } | } | ||||
| @@ -159,21 +159,21 @@ public class Touch extends Task { | |||||
| * that fails with MEDIUM - throw an exception if both | * that fails with MEDIUM - throw an exception if both | ||||
| * fail. | * fail. | ||||
| */ | */ | ||||
| DateFormat df = | |||||
| DateFormat df = | |||||
| DateFormat.getDateTimeInstance(DateFormat.SHORT, | DateFormat.getDateTimeInstance(DateFormat.SHORT, | ||||
| DateFormat.SHORT, | DateFormat.SHORT, | ||||
| Locale.US); | Locale.US); | ||||
| try { | try { | ||||
| setMillis(df.parse(dateTime).getTime()); | setMillis(df.parse(dateTime).getTime()); | ||||
| } catch (ParseException pe) { | } catch (ParseException pe) { | ||||
| df = | |||||
| df = | |||||
| DateFormat.getDateTimeInstance(DateFormat.SHORT, | DateFormat.getDateTimeInstance(DateFormat.SHORT, | ||||
| DateFormat.MEDIUM, | DateFormat.MEDIUM, | ||||
| Locale.US); | Locale.US); | ||||
| try { | try { | ||||
| setMillis(df.parse(dateTime).getTime()); | setMillis(df.parse(dateTime).getTime()); | ||||
| } catch (ParseException pe2) { | } catch (ParseException pe2) { | ||||
| throw new BuildException(pe2.getMessage(), pe, | |||||
| throw new BuildException(pe2.getMessage(), pe, | |||||
| getLocation()); | getLocation()); | ||||
| } | } | ||||
| } | } | ||||
| @@ -204,18 +204,18 @@ public class Touch extends Task { | |||||
| try { | try { | ||||
| fileUtils.createNewFile(file); | fileUtils.createNewFile(file); | ||||
| } catch (IOException ioe) { | } catch (IOException ioe) { | ||||
| throw new BuildException("Could not create " + file, ioe, | |||||
| throw new BuildException("Could not create " + file, ioe, | |||||
| getLocation()); | getLocation()); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if (millis >= 0 && | |||||
| if (millis >= 0 && | |||||
| JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) { | JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) { | ||||
| log("modification time of files cannot be set in JDK 1.1", | log("modification time of files cannot be set in JDK 1.1", | ||||
| Project.MSG_WARN); | Project.MSG_WARN); | ||||
| return; | return; | ||||
| } | |||||
| } | |||||
| boolean resetMillis = false; | boolean resetMillis = false; | ||||
| if (millis < 0) { | if (millis < 0) { | ||||
| @@ -239,7 +239,7 @@ public class Touch extends Task { | |||||
| for (int j = 0; j < srcFiles.length ; j++) { | for (int j = 0; j < srcFiles.length ; j++) { | ||||
| touch(new File(fromDir, srcFiles[j])); | touch(new File(fromDir, srcFiles[j])); | ||||
| } | } | ||||
| for (int j = 0; j < srcDirs.length ; j++) { | for (int j = 0; j < srcDirs.length ; j++) { | ||||
| touch(new File(fromDir, srcDirs[j])); | touch(new File(fromDir, srcDirs[j])); | ||||
| } | } | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * 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. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * 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. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * 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 | * types are things likepaths or filesets that can be defined at | ||||
| * the project level and referenced via their ID attribute.</p> | * the project level and referenced via their ID attribute.</p> | ||||
| * <p>Custom data types usually need custom tasks to put them to good use.</p> | * <p>Custom data types usually need custom tasks to put them to good use.</p> | ||||
| * | |||||
| * | |||||
| * @author Stefan Bodewig | * @author Stefan Bodewig | ||||
| * @since Ant 1.4 | * @since Ant 1.4 | ||||
| * @ant.task category="internal" | * @ant.task category="internal" | ||||
| @@ -118,7 +118,7 @@ public class Untar extends Expand { | |||||
| * @since Ant 1.6 | * @since Ant 1.6 | ||||
| */ | */ | ||||
| public void setEncoding(String encoding) { | public void setEncoding(String encoding) { | ||||
| throw new BuildException("The " + getTaskName() | |||||
| throw new BuildException("The " + getTaskName() | |||||
| + " task doesn't support the encoding" | + " task doesn't support the encoding" | ||||
| + " attribute", getLocation()); | + " attribute", getLocation()); | ||||
| } | } | ||||
| @@ -72,9 +72,9 @@ import org.apache.tools.ant.util.SourceFileScanner; | |||||
| * Sets the given property if the specified target has a timestamp | * Sets the given property if the specified target has a timestamp | ||||
| * greater than all of the source files. | * greater than all of the source files. | ||||
| * | * | ||||
| * @author William Ferguson | |||||
| * <a href="mailto:williamf@mincom.com">williamf@mincom.com</a> | |||||
| * @author Hiroaki Nakamura | |||||
| * @author William Ferguson | |||||
| * <a href="mailto:williamf@mincom.com">williamf@mincom.com</a> | |||||
| * @author Hiroaki Nakamura | |||||
| * <a href="mailto:hnakamur@mc.neweb.ne.jp">hnakamur@mc.neweb.ne.jp</a> | * <a href="mailto:hnakamur@mc.neweb.ne.jp">hnakamur@mc.neweb.ne.jp</a> | ||||
| * @author Stefan Bodewig | * @author Stefan Bodewig | ||||
| * @author <a href="http://nerdmonkey.com">Eli Tucker</a> | * @author <a href="http://nerdmonkey.com">Eli Tucker</a> | ||||
| @@ -119,7 +119,7 @@ public class UpToDate extends Task implements Condition { | |||||
| */ | */ | ||||
| private String getValue() { | private String getValue() { | ||||
| return (_value != null) ? _value : "true"; | return (_value != null) ? _value : "true"; | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * The file which must be more up-to-date than (each of) the source file(s) | * 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 the target file is not there, then it can't be up-to-date | ||||
| if (_targetFile != null && !_targetFile.exists()) { | if (_targetFile != null && !_targetFile.exists()) { | ||||
| log("The targetfile \"" + _targetFile.getAbsolutePath() | |||||
| log("The targetfile \"" + _targetFile.getAbsolutePath() | |||||
| + "\" does not exist.", Project.MSG_VERBOSE); | + "\" does not exist.", Project.MSG_VERBOSE); | ||||
| return false; | return false; | ||||
| } | |||||
| } | |||||
| // if the source file isn't there, throw an exception | // if the source file isn't there, throw an exception | ||||
| if (_sourceFile != null && !_sourceFile.exists()) { | if (_sourceFile != null && !_sourceFile.exists()) { | ||||
| throw new BuildException(_sourceFile.getAbsolutePath() | |||||
| throw new BuildException(_sourceFile.getAbsolutePath() | |||||
| + " not found."); | + " not found."); | ||||
| } | } | ||||
| @@ -226,14 +226,14 @@ public class UpToDate extends Task implements Condition { | |||||
| */ | */ | ||||
| public void execute() throws BuildException { | public void execute() throws BuildException { | ||||
| if (_property == null) { | if (_property == null) { | ||||
| throw new BuildException("property attribute is required.", | |||||
| throw new BuildException("property attribute is required.", | |||||
| getLocation()); | getLocation()); | ||||
| } | } | ||||
| boolean upToDate = eval(); | boolean upToDate = eval(); | ||||
| if (upToDate) { | if (upToDate) { | ||||
| this.getProject().setNewProperty(_property, getValue()); | this.getProject().setNewProperty(_property, getValue()); | ||||
| if (mapperElement == null) { | if (mapperElement == null) { | ||||
| log("File \"" + _targetFile.getAbsolutePath() | |||||
| log("File \"" + _targetFile.getAbsolutePath() | |||||
| + "\" is up-to-date.", Project.MSG_VERBOSE); | + "\" is up-to-date.", Project.MSG_VERBOSE); | ||||
| } else { | } else { | ||||
| log("All target files are up-to-date.", | log("All target files are up-to-date.", | ||||
| @@ -172,7 +172,7 @@ public class WaitFor extends ConditionBase { | |||||
| } | } | ||||
| /** | /** | ||||
| * The enumeration of units: | |||||
| * The enumeration of units: | |||||
| * millisecond, second, minute, hour, day, week | * millisecond, second, minute, hour, day, week | ||||
| * @todo we use timestamps in many places, why not factor this out | * @todo we use timestamps in many places, why not factor this out | ||||
| */ | */ | ||||
| @@ -174,7 +174,7 @@ public class War extends Jar { | |||||
| /** | /** | ||||
| * Overriden from Zip class to deal with web.xml | * 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) | int mode) | ||||
| throws IOException { | throws IOException { | ||||
| // If the file being added is WEB-INF/web.xml, we warn if it's | // If the file being added is WEB-INF/web.xml, we warn if it's | ||||
| @@ -112,8 +112,8 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||||
| /** Classpath to use when trying to load the XSL processor */ | /** Classpath to use when trying to load the XSL processor */ | ||||
| private Path classpath = null; | 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 */ | * processor */ | ||||
| private XSLTLiaison liaison; | private XSLTLiaison liaison; | ||||
| @@ -264,7 +264,7 @@ public class XmlProperty extends org.apache.tools.ant.Task { | |||||
| try { | try { | ||||
| log("Loading " + src.getAbsolutePath(), Project.MSG_VERBOSE); | log("Loading " + src.getAbsolutePath(), Project.MSG_VERBOSE); | ||||
| if (src.exists()) { | if (src.exists()) { | ||||
| configurationStream = | configurationStream = | ||||
| @@ -297,7 +297,7 @@ public class XmlProperty extends org.apache.tools.ant.Task { | |||||
| log("Unable to find property file: " + src.getAbsolutePath(), | log("Unable to find property file: " + src.getAbsolutePath(), | ||||
| Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
| } | } | ||||
| } catch (SAXException sxe) { | } catch (SAXException sxe) { | ||||
| // Error generated during parsing | // Error generated during parsing | ||||
| Exception x = sxe; | Exception x = sxe; | ||||
| @@ -322,7 +322,7 @@ public class XmlProperty extends org.apache.tools.ant.Task { | |||||
| } | } | ||||
| /** Iterate through all nodes in the tree. */ | /** Iterate through all nodes in the tree. */ | ||||
| private void addNodeRecursively(Node node, String prefix, | |||||
| private void addNodeRecursively(Node node, String prefix, | |||||
| Object container) { | Object container) { | ||||
| // Set the prefix for this node to include its tag name. | // 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 | // For each child, pass the object added by | ||||
| // processNode to its children -- in other word, each | // processNode to its children -- in other word, each | ||||
| // object can pass information along to its children. | // object can pass information along to its children. | ||||
| addNodeRecursively(nodeChildren.item(i), nodePrefix, | |||||
| addNodeRecursively(nodeChildren.item(i), nodePrefix, | |||||
| nodeObject); | nodeObject); | ||||
| } | } | ||||
| } | } | ||||
| @@ -389,7 +389,7 @@ public class XmlProperty extends org.apache.tools.ant.Task { | |||||
| // Is there an id attribute? | // Is there an id attribute? | ||||
| Node idNode = nodeAttributes.getNamedItem(ID); | Node idNode = nodeAttributes.getNamedItem(ID); | ||||
| id = (semanticAttributes && idNode != null | |||||
| id = (semanticAttributes && idNode != null | |||||
| ? idNode.getNodeValue() : null); | ? idNode.getNodeValue() : null); | ||||
| // Now, iterate through the attributes adding them. | // 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 nodeName = attributeNode.getNodeName(); | ||||
| String attributeValue = getAttributeValue(attributeNode); | String attributeValue = getAttributeValue(attributeNode); | ||||
| Path containingPath = | |||||
| (container != null && container instanceof Path | |||||
| Path containingPath = | |||||
| (container != null && container instanceof Path | |||||
| ? (Path) container : null ); | ? (Path) container : null ); | ||||
| /* | /* | ||||
| @@ -419,15 +419,15 @@ public class XmlProperty extends org.apache.tools.ant.Task { | |||||
| if (nodeName.equals(ID)) { | if (nodeName.equals(ID)) { | ||||
| // ID has already been found above. | // ID has already been found above. | ||||
| continue; | continue; | ||||
| } else if (containingPath != null | |||||
| } else if (containingPath != null | |||||
| && nodeName.equals(PATH)) { | && nodeName.equals(PATH)) { | ||||
| // A "path" attribute for a node within a Path object. | // A "path" attribute for a node within a Path object. | ||||
| containingPath.setPath(attributeValue); | containingPath.setPath(attributeValue); | ||||
| } else if (container instanceof Path | |||||
| } else if (container instanceof Path | |||||
| && nodeName.equals(REF_ID)) { | && nodeName.equals(REF_ID)) { | ||||
| // A "refid" attribute for a node within a Path object. | // A "refid" attribute for a node within a Path object. | ||||
| containingPath.setPath(attributeValue); | containingPath.setPath(attributeValue); | ||||
| } else if (container instanceof Path | |||||
| } else if (container instanceof Path | |||||
| && nodeName.equals(LOCATION)) { | && nodeName.equals(LOCATION)) { | ||||
| // A "location" attribute for a node within a | // A "location" attribute for a node within a | ||||
| // Path object. | // Path object. | ||||
| @@ -454,16 +454,16 @@ public class XmlProperty extends org.apache.tools.ant.Task { | |||||
| if (node.getNodeType() == Node.TEXT_NODE) { | if (node.getNodeType() == Node.TEXT_NODE) { | ||||
| // For the text node, add a property. | // For the text node, add a property. | ||||
| nodeText = getAttributeValue(node); | nodeText = getAttributeValue(node); | ||||
| } else if ((node.getNodeType() == Node.ELEMENT_NODE) | |||||
| } else if ((node.getNodeType() == Node.ELEMENT_NODE) | |||||
| && (node.getChildNodes().getLength() == 1) | && (node.getChildNodes().getLength() == 1) | ||||
| && (node.getFirstChild().getNodeType() == Node.CDATA_SECTION_NODE)) { | && (node.getFirstChild().getNodeType() == Node.CDATA_SECTION_NODE)) { | ||||
| nodeText = node.getFirstChild().getNodeValue(); | nodeText = node.getFirstChild().getNodeValue(); | ||||
| } | } | ||||
| if (nodeText != null) { | if (nodeText != null) { | ||||
| // If the containing object was a String, then use it as the ID. | // If the containing object was a String, then use it as the ID. | ||||
| if (semanticAttributes && id == null | |||||
| if (semanticAttributes && id == null | |||||
| && container instanceof String) { | && container instanceof String) { | ||||
| id = (String) container; | id = (String) container; | ||||
| System.out.println("Setting id = " + id); | System.out.println("Setting id = " + id); | ||||
| @@ -528,7 +528,7 @@ public class XmlProperty extends org.apache.tools.ant.Task { | |||||
| if (attributeName.equals(REF_ID)) { | if (attributeName.equals(REF_ID)) { | ||||
| return ""; | return ""; | ||||
| // Otherwise, return it appended unless property to hide it is set. | // Otherwise, return it appended unless property to hide it is set. | ||||
| } else if (!isSemanticAttribute(attributeName) | |||||
| } else if (!isSemanticAttribute(attributeName) | |||||
| || includeSemanticAttribute) { | || includeSemanticAttribute) { | ||||
| return "." + attributeName; | return "." + attributeName; | ||||
| } else { | } else { | ||||
| @@ -436,7 +436,7 @@ public class Zip extends MatchingTask { | |||||
| addResources(fss[i], addThem[i], zOut); | addResources(fss[i], addThem[i], zOut); | ||||
| } | } | ||||
| } | } | ||||
| if (doUpdate) { | if (doUpdate) { | ||||
| addingNewFiles = false; | addingNewFiles = false; | ||||
| ZipFileSet oldFiles = new ZipFileSet(); | ZipFileSet oldFiles = new ZipFileSet(); | ||||
| @@ -447,7 +447,7 @@ public class Zip extends MatchingTask { | |||||
| PatternSet.NameEntry ne = oldFiles.createExclude(); | PatternSet.NameEntry ne = oldFiles.createExclude(); | ||||
| ne.setName((String) addedFiles.elementAt(i)); | ne.setName((String) addedFiles.elementAt(i)); | ||||
| } | } | ||||
| DirectoryScanner ds = | |||||
| DirectoryScanner ds = | |||||
| oldFiles.getDirectoryScanner(getProject()); | oldFiles.getDirectoryScanner(getProject()); | ||||
| ((ZipScanner) ds).setEncoding(encoding); | ((ZipScanner) ds).setEncoding(encoding); | ||||
| String[] f = ds.getIncludedFiles(); | String[] f = ds.getIncludedFiles(); | ||||
| @@ -455,7 +455,7 @@ public class Zip extends MatchingTask { | |||||
| for (int i = 0; i < f.length; i++) { | for (int i = 0; i < f.length; i++) { | ||||
| r[i] = ds.getResource(f[i]); | r[i] = ds.getResource(f[i]); | ||||
| } | } | ||||
| addResources(oldFiles, r, zOut); | addResources(oldFiles, r, zOut); | ||||
| } | } | ||||
| finalizeZipOutputStream(zOut); | finalizeZipOutputStream(zOut); | ||||
| @@ -580,7 +580,7 @@ public class Zip extends MatchingTask { | |||||
| } else { | } else { | ||||
| zf = new ZipFile(zfs.getSrc(getProject()), encoding); | zf = new ZipFile(zfs.getSrc(getProject()), encoding); | ||||
| } | } | ||||
| for (int i = 0; i < resources.length; i++) { | for (int i = 0; i < resources.length; i++) { | ||||
| String name = null; | String name = null; | ||||
| if (fullpath.length() > 0) { | if (fullpath.length() > 0) { | ||||
| @@ -589,26 +589,26 @@ public class Zip extends MatchingTask { | |||||
| name = resources[i].getName(); | name = resources[i].getName(); | ||||
| } | } | ||||
| name = name.replace(File.separatorChar, '/'); | name = name.replace(File.separatorChar, '/'); | ||||
| if ("".equals(name)) { | if ("".equals(name)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (resources[i].isDirectory() && ! name.endsWith("/")) { | if (resources[i].isDirectory() && ! name.endsWith("/")) { | ||||
| name = name + "/"; | name = name + "/"; | ||||
| } | } | ||||
| addParentDirs(base, name, zOut, prefix, dirMode); | addParentDirs(base, name, zOut, prefix, dirMode); | ||||
| if (!resources[i].isDirectory() && dealingWithFiles) { | if (!resources[i].isDirectory() && dealingWithFiles) { | ||||
| File f = fileUtils.resolveFile(base, | |||||
| File f = fileUtils.resolveFile(base, | |||||
| resources[i].getName()); | resources[i].getName()); | ||||
| zipFile(f, zOut, prefix + name, fileMode); | zipFile(f, zOut, prefix + name, fileMode); | ||||
| } else if (!resources[i].isDirectory()) { | } else if (!resources[i].isDirectory()) { | ||||
| ZipEntry ze = zf.getEntry(resources[i].getName()); | ZipEntry ze = zf.getEntry(resources[i].getName()); | ||||
| if (ze != null) { | 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()); | : ze.getUnixMode()); | ||||
| } | } | ||||
| } | } | ||||
| @@ -734,18 +734,18 @@ public class Zip extends MatchingTask { | |||||
| if (emptyBehavior.equals("skip")) { | if (emptyBehavior.equals("skip")) { | ||||
| if (doUpdate) { | 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); | Project.MSG_VERBOSE); | ||||
| } else { | } 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); | Project.MSG_WARN); | ||||
| } | } | ||||
| } else if (emptyBehavior.equals("fail")) { | } else if (emptyBehavior.equals("fail")) { | ||||
| throw new BuildException("Cannot create " + archiveType | throw new BuildException("Cannot create " + archiveType | ||||
| + " archive " + zipFile + | + " archive " + zipFile + | ||||
| ": no files were included.", | |||||
| ": no files were included.", | |||||
| getLocation()); | getLocation()); | ||||
| } else { | } else { | ||||
| // Create. | // Create. | ||||
| @@ -768,13 +768,13 @@ public class Zip extends MatchingTask { | |||||
| Resource[][] newerResources = new Resource[filesets.length][]; | Resource[][] newerResources = new Resource[filesets.length][]; | ||||
| for (int i = 0; i < filesets.length; i++) { | for (int i = 0; i < filesets.length; i++) { | ||||
| if (!(fileset instanceof ZipFileSet) | |||||
| if (!(fileset instanceof ZipFileSet) | |||||
| || ((ZipFileSet) fileset).getSrc(getProject()) == null) { | || ((ZipFileSet) fileset).getSrc(getProject()) == null) { | ||||
| File base = filesets[i].getDir(getProject()); | File base = filesets[i].getDir(getProject()); | ||||
| for (int j = 0; j < initialResources[i].length; j++) { | for (int j = 0; j < initialResources[i].length; j++) { | ||||
| File resourceAsFile = | |||||
| fileUtils.resolveFile(base, | |||||
| File resourceAsFile = | |||||
| fileUtils.resolveFile(base, | |||||
| initialResources[i][j].getName()); | initialResources[i][j].getName()); | ||||
| if (resourceAsFile.equals(zipFile)) { | if (resourceAsFile.equals(zipFile)) { | ||||
| throw new BuildException("A zip file cannot include " | throw new BuildException("A zip file cannot include " | ||||
| @@ -789,7 +789,7 @@ public class Zip extends MatchingTask { | |||||
| newerResources[i] = new Resource[] {}; | newerResources[i] = new Resource[] {}; | ||||
| continue; | continue; | ||||
| } | } | ||||
| FileNameMapper myMapper = new IdentityMapper(); | FileNameMapper myMapper = new IdentityMapper(); | ||||
| if (filesets[i] instanceof ZipFileSet) { | if (filesets[i] instanceof ZipFileSet) { | ||||
| ZipFileSet zfs = (ZipFileSet) filesets[i]; | ZipFileSet zfs = (ZipFileSet) filesets[i]; | ||||
| @@ -819,8 +819,8 @@ public class Zip extends MatchingTask { | |||||
| if (doFilesonly) { | if (doFilesonly) { | ||||
| resources = selectFileResources(resources); | resources = selectFileResources(resources); | ||||
| } | } | ||||
| newerResources[i] = | |||||
| newerResources[i] = | |||||
| ResourceUtils.selectOutOfDateSources(this, | ResourceUtils.selectOutOfDateSources(this, | ||||
| resources, | resources, | ||||
| myMapper, | myMapper, | ||||
| @@ -838,21 +838,21 @@ public class Zip extends MatchingTask { | |||||
| // we are recreating the archive, need all resources | // we are recreating the archive, need all resources | ||||
| return new ArchiveState(true, initialResources); | return new ArchiveState(true, initialResources); | ||||
| } | } | ||||
| return new ArchiveState(needsUpdate, newerResources); | return new ArchiveState(needsUpdate, newerResources); | ||||
| } | } | ||||
| /** | /** | ||||
| * Fetch all included and not excluded resources from the sets. | * Fetch all included and not excluded resources from the sets. | ||||
| * | * | ||||
| * <p>Included directories will preceede included files.</p> | |||||
| * <p>Included directories will preceede included files.</p> | |||||
| * | * | ||||
| * @since Ant 1.5.2 | * @since Ant 1.5.2 | ||||
| */ | */ | ||||
| protected Resource[][] grabResources(FileSet[] filesets) { | protected Resource[][] grabResources(FileSet[] filesets) { | ||||
| Resource[][] result = new Resource[filesets.length][]; | Resource[][] result = new Resource[filesets.length][]; | ||||
| for (int i = 0; i < filesets.length; i++) { | for (int i = 0; i < filesets.length; i++) { | ||||
| DirectoryScanner rs = | |||||
| DirectoryScanner rs = | |||||
| filesets[i].getDirectoryScanner(getProject()); | filesets[i].getDirectoryScanner(getProject()); | ||||
| if (rs instanceof ZipScanner) { | if (rs instanceof ZipScanner) { | ||||
| ((ZipScanner) rs).setEncoding(encoding); | ((ZipScanner) rs).setEncoding(encoding); | ||||
| @@ -866,7 +866,7 @@ public class Zip extends MatchingTask { | |||||
| for (int j = 0; j < files.length; j++) { | for (int j = 0; j < files.length; j++) { | ||||
| resources.addElement(rs.getResource(files[j])); | resources.addElement(rs.getResource(files[j])); | ||||
| } | } | ||||
| result[i] = new Resource[resources.size()]; | result[i] = new Resource[resources.size()]; | ||||
| resources.copyInto(result[i]); | resources.copyInto(result[i]); | ||||
| } | } | ||||
| @@ -1017,7 +1017,7 @@ public class Zip extends MatchingTask { | |||||
| * | * | ||||
| * @since Ant 1.5.2 | * @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) | int mode) | ||||
| throws IOException { | throws IOException { | ||||
| if (file.equals(zipFile)) { | if (file.equals(zipFile)) { | ||||
| @@ -1120,7 +1120,7 @@ public class Zip extends MatchingTask { | |||||
| /** | /** | ||||
| * @return true if all individual arrays are empty | * @return true if all individual arrays are empty | ||||
| * | |||||
| * | |||||
| * @since Ant 1.5.2 | * @since Ant 1.5.2 | ||||
| */ | */ | ||||
| protected final static boolean isEmpty(Resource[][] r) { | protected final static boolean isEmpty(Resource[][] r) { | ||||
| @@ -1141,13 +1141,13 @@ public class Zip extends MatchingTask { | |||||
| if (orig.length == 0) { | if (orig.length == 0) { | ||||
| return orig; | return orig; | ||||
| } | } | ||||
| Vector v = new Vector(orig.length); | Vector v = new Vector(orig.length); | ||||
| for (int i = 0; i < orig.length; i++) { | for (int i = 0; i < orig.length; i++) { | ||||
| if (!orig[i].isDirectory()) { | if (!orig[i].isDirectory()) { | ||||
| v.addElement(orig[i]); | v.addElement(orig[i]); | ||||
| } else { | } else { | ||||
| log("Ignoring directory " + orig[i].getName() | |||||
| log("Ignoring directory " + orig[i].getName() | |||||
| + " as only files will be added.", Project.MSG_VERBOSE); | + " as only files will be added.", Project.MSG_VERBOSE); | ||||
| } | } | ||||
| } | } | ||||