diff --git a/src/main/org/apache/tools/ant/ExitStatusException.java b/src/main/org/apache/tools/ant/ExitStatusException.java index 93bb0c169..8df49dc93 100644 --- a/src/main/org/apache/tools/ant/ExitStatusException.java +++ b/src/main/org/apache/tools/ant/ExitStatusException.java @@ -1,5 +1,5 @@ /* - * Copyright 2004 The Apache Software Foundation + * Copyright 2004-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ public class ExitStatusException extends BuildException { private int status; /** - * Constructs an ExitStatusException. + * Constructs an ExitStatusException. * @param status the associated status code */ public ExitStatusException(int status) { @@ -36,7 +36,7 @@ public class ExitStatusException extends BuildException { } /** - * Constructs an ExitStatusException. + * Constructs an ExitStatusException. * @param msg the associated message * @param status the associated status code */ @@ -47,9 +47,9 @@ public class ExitStatusException extends BuildException { /** * Get the status code. - * @return int + * @return int */ public int getStatus() { return status; } -} +} \ No newline at end of file diff --git a/src/main/org/apache/tools/ant/Target.java b/src/main/org/apache/tools/ant/Target.java index f84cc9fb8..2f78860aa 100644 --- a/src/main/org/apache/tools/ant/Target.java +++ b/src/main/org/apache/tools/ant/Target.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2004 The Apache Software Foundation + * Copyright 2000-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,6 +54,7 @@ public class Target implements TaskContainer { /** Sole constructor. */ public Target() { + //empty } /** @@ -79,7 +80,7 @@ public class Target implements TaskContainer { /** * Sets the location of this target's definition. * - * @param location Location + * @param location Location * @since 1.6.2 */ public void setLocation(Location location) { @@ -89,7 +90,7 @@ public class Target implements TaskContainer { /** * Get the location of this target's definition. * - * @return Location + * @return Location * @since 1.6.2 */ public Location getLocation() { @@ -208,11 +209,8 @@ public class Target implements TaskContainer { * @return an enumeration of the dependencies of this target */ public Enumeration getDependencies() { - if (dependencies != null) { - return Collections.enumeration(dependencies); - } else { - return new CollectionUtils.EmptyEnumeration(); - } + return (dependencies != null ? Collections.enumeration(dependencies) + : new CollectionUtils.EmptyEnumeration()); } /** @@ -224,7 +222,8 @@ public class Target implements TaskContainer { public boolean dependsOn(String other) { Project p = getProject(); Hashtable t = (p == null) ? null : p.getTargets(); - return (p != null && p.topoSort(getName(), t, false).contains(t.get(other))); + return (p != null + && p.topoSort(getName(), t, false).contains(t.get(other))); } /** @@ -439,4 +438,4 @@ public class Target implements TaskContainer { String test = project.replaceProperties(unlessCondition); return project.getProperty(test) == null; } -} +} \ No newline at end of file diff --git a/src/main/org/apache/tools/ant/filters/StringInputStream.java b/src/main/org/apache/tools/ant/filters/StringInputStream.java index 4d1b14fb0..68a0e878a 100644 --- a/src/main/org/apache/tools/ant/filters/StringInputStream.java +++ b/src/main/org/apache/tools/ant/filters/StringInputStream.java @@ -39,10 +39,10 @@ public class StringInputStream extends ReaderInputStream { * Composes a stream from a String with the specified encoding * * @param source The string to read from. Must not be null. - * @param encoding The encoding scheme. Also must not be null. + * @param encoding The encoding scheme. Also must not be null. */ public StringInputStream(String source, String encoding) { super(new StringReader(source), encoding); } -} +} \ No newline at end of file diff --git a/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java b/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java index 532a8eef2..b30698d27 100644 --- a/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2004 The Apache Software Foundation + * Copyright 2002-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -341,36 +341,36 @@ public abstract class AbstractCvsTask extends Task { + retCode + StringUtils.LINE_SEP + "Command line was [" - + actualCommandLine + "]", getLocation()); + + actualCommandLine + "]", + getLocation()); } } catch (IOException e) { if (failOnError) { throw new BuildException(e, getLocation()); - } else { - log("Caught exception: " + e.getMessage(), Project.MSG_WARN); } + log("Caught exception: " + e.getMessage(), Project.MSG_WARN); } catch (BuildException e) { - if (failOnError) { - throw(e); - } else { + if (failOnError) { + throw(e); + } Throwable t = e.getException(); if (t == null) { - t = e; + t = e; } log("Caught exception: " + t.getMessage(), Project.MSG_WARN); - } } catch (Exception e) { - if (failOnError) { - throw new BuildException(e, getLocation()); - } else { + if (failOnError) { + throw new BuildException(e, getLocation()); + } log("Caught exception: " + e.getMessage(), Project.MSG_WARN); - } + } } /** * do the work - * @throws BuildException if failonerror is set to true and the cvs command fails. + * @throws BuildException if failonerror is set to true and the + * cvs command fails. */ public void execute() throws BuildException { @@ -615,8 +615,8 @@ public abstract class AbstractCvsTask extends Task { /** * Use the most recent revision no later than the given date. - * @param p a date as string in a format that the CVS executable can understand - * see man cvs + * @param p a date as string in a format that the CVS executable + * can understand see man cvs */ public void setDate(String p) { if (p != null && p.trim().length() > 0) { @@ -738,7 +738,8 @@ public abstract class AbstractCvsTask extends Task { if (cvsPackage != null) { c.createArgument().setLine(cvsPackage); } - if (this.compression > 0 && this.compression <= MAXIMUM_COMRESSION_LEVEL) { + if (this.compression > 0 + && this.compression <= MAXIMUM_COMRESSION_LEVEL) { c.createArgument(true).setValue("-z" + this.compression); } if (quiet && !reallyquiet) { diff --git a/src/main/org/apache/tools/ant/taskdefs/Ant.java b/src/main/org/apache/tools/ant/taskdefs/Ant.java index b3c5df812..00f3353ea 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Ant.java +++ b/src/main/org/apache/tools/ant/taskdefs/Ant.java @@ -79,7 +79,7 @@ public class Ant extends Task { private String antFile = null; /** the output */ - private String output = null; + private String output = null; /** should we inherit properties from the parent ? */ private boolean inheritAll = true; @@ -112,6 +112,7 @@ public class Ant extends Task { * simple constructor */ public Ant() { + //default } /** @@ -223,67 +224,61 @@ public class Ant extends Task { /** * @see Task#handleOutput(String) - * * @since Ant 1.5 */ - public void handleOutput(String output) { + public void handleOutput(String outputToHandle) { if (newProject != null) { - newProject.demuxOutput(output, false); + newProject.demuxOutput(outputToHandle, false); } else { - super.handleOutput(output); + super.handleOutput(outputToHandle); } } /** * @see Task#handleInput(byte[], int, int) - * * @since Ant 1.6 */ public int handleInput(byte[] buffer, int offset, int length) throws IOException { if (newProject != null) { return newProject.demuxInput(buffer, offset, length); - } else { - return super.handleInput(buffer, offset, length); } + return super.handleInput(buffer, offset, length); } /** * @see Task#handleFlush(String) - * * @since Ant 1.5.2 */ - public void handleFlush(String output) { + public void handleFlush(String toFlush) { if (newProject != null) { - newProject.demuxFlush(output, false); + newProject.demuxFlush(toFlush, false); } else { - super.handleFlush(output); + super.handleFlush(toFlush); } } /** * @see Task#handleErrorOutput(String) - * * @since Ant 1.5 */ - public void handleErrorOutput(String output) { + public void handleErrorOutput(String errorOutputToHandle) { if (newProject != null) { - newProject.demuxOutput(output, true); + newProject.demuxOutput(errorOutputToHandle, true); } else { - super.handleErrorOutput(output); + super.handleErrorOutput(errorOutputToHandle); } } /** * @see Task#handleErrorFlush(String) - * * @since Ant 1.5.2 */ - public void handleErrorFlush(String output) { + public void handleErrorFlush(String errorOutputToFlush) { if (newProject != null) { - newProject.demuxFlush(output, true); + newProject.demuxFlush(errorOutputToFlush, true); } else { - super.handleErrorFlush(output); + super.handleErrorFlush(errorOutputToFlush); } } @@ -344,11 +339,10 @@ public class Ant extends Task { if (getTaskName().equals("antcall")) { throw new BuildException("antcall must not be used at" + " the top level."); - } else { - throw new BuildException(getTaskName() + " task at the" - + " top level must not invoke" - + " its own build file."); } + throw new BuildException(getTaskName() + " task at the" + + " top level must not invoke" + + " its own build file."); } } @@ -375,28 +369,29 @@ public class Ant extends Task { if (locals.contains(owningTargetName)) { throw new BuildException(getTaskName() + " task calling " + "its own parent target."); - } else { - boolean circular = false; - for (Iterator it = locals.iterator(); !circular && it.hasNext();) { - Target other = (Target) (getProject().getTargets().get( - (String) (it.next()))); - circular |= (other != null - && other.dependsOn(owningTargetName)); - } - if (circular) { - throw new BuildException(getTaskName() - + " task calling a target" - + " that depends on" - + " its parent target \'" - + owningTargetName - + "\'."); - } + } + boolean circular = false; + for (Iterator it = locals.iterator(); + !circular && it.hasNext();) { + Target other = + (Target) (getProject().getTargets().get(it.next())); + circular |= (other != null + && other.dependsOn(owningTargetName)); + } + if (circular) { + throw new BuildException(getTaskName() + + " task calling a target" + + " that depends on" + + " its parent target \'" + + owningTargetName + + "\'."); } } addReferences(); - if (locals.size() > 0 && !(locals.size() == 1 && locals.get(0) == "")) { + if (locals.size() > 0 && !(locals.size() == 1 + && locals.get(0) == "")) { Throwable t = null; try { log("Entering " + antFile + "...", Project.MSG_VERBOSE); @@ -567,7 +562,8 @@ public class Ant extends Task { * Copies all properties from the given table to the new project - * omitting those that have already been set in the new project as * well as properties named basedir or ant.file. - * @param props properties Hashtable to copy to the new project. + * @param props properties Hashtable to copy to the + * new project. * @since Ant 1.6 */ private void addAlmostAll(Hashtable props) { @@ -593,10 +589,10 @@ public class Ant extends Task { * Defaults to the current project's basedir, unless inheritall * has been set to false, in which case it doesn't have a default * value. This will override the basedir setting of the called project. - * @param d new directory as File. + * @param dir new directory as File. */ - public void setDir(File d) { - this.dir = d; + public void setDir(File dir) { + this.dir = dir; } /** @@ -604,23 +600,23 @@ public class Ant extends Task { * to be a filename relative to the dir attribute given. * @param s the String build file name. */ - public void setAntfile(String s) { + public void setAntfile(String antFile) { // @note: it is a string and not a file to handle relative/absolute // otherwise a relative file will be resolved based on the current // basedir. - this.antFile = s; + this.antFile = antFile; } /** * The target of the new Ant project to execute. * Defaults to the new project's default target. - * @param s the name of the target to invoke. + * @param targetToAdd the name of the target to invoke. */ - public void setTarget(String s) { - if (s.equals("")) { + public void setTarget(String targetToAdd) { + if (targetToAdd.equals("")) { throw new BuildException("target attribute must not be empty"); } - targets.add(s); + targets.add(targetToAdd); targetAttributeSet = true; } @@ -628,10 +624,10 @@ public class Ant extends Task { * Set the filename to write the output to. This is relative to the value * of the dir attribute if it has been set or to the base directory of the * current project otherwise. - * @param s the name of the file to which the output should go. + * @param outputFile the name of the file to which the output should go. */ - public void setOutput(String s) { - this.output = s; + public void setOutput(String outputFile) { + this.output = outputFile; } /** @@ -653,15 +649,15 @@ public class Ant extends Task { /** * Add a Reference element identifying a data type to carry * over to the new project. - * @param r Reference to add. + * @param ref Reference to add. */ - public void addReference(Reference r) { - references.addElement(r); + public void addReference(Reference ref) { + references.addElement(ref); } /** * Add a target to this Ant invocation. - * @param t the TargetElement to add. + * @param t the TargetElement to add. * @since Ant 1.6.3 */ public void addConfiguredTarget(TargetElement t) { @@ -702,7 +698,7 @@ public class Ant extends Task { /** Creates a reference to be configured by Ant. */ public Reference() { - super(); + super(); } private String targetid = null; @@ -740,11 +736,12 @@ public class Ant extends Task { * Default constructor. */ public TargetElement() { + //default } /** * Set the name of this TargetElement. - * @param name the String target name. + * @param name the String target name. */ public void setName(String name) { this.name = name; @@ -752,10 +749,10 @@ public class Ant extends Task { /** * Get the name of this TargetElement. - * @return String. + * @return String. */ public String getName() { return name; } } -} +} \ No newline at end of file diff --git a/src/main/org/apache/tools/ant/taskdefs/Apt.java b/src/main/org/apache/tools/ant/taskdefs/Apt.java index 0d9080a4a..379ce6fc9 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Apt.java +++ b/src/main/org/apache/tools/ant/taskdefs/Apt.java @@ -61,6 +61,7 @@ public class Apt /** Constructor for Option */ public Option() { + //default } /** @@ -121,8 +122,7 @@ public class Apt * @param compiler not used. */ public void setCompiler(String compiler) { - log(ERROR_IGNORING_COMPILER_OPTION, - Project.MSG_WARN); + log(ERROR_IGNORING_COMPILER_OPTION, Project.MSG_WARN); } /** diff --git a/src/main/org/apache/tools/ant/taskdefs/CallTarget.java b/src/main/org/apache/tools/ant/taskdefs/CallTarget.java index f96c0f328..305aabf28 100644 --- a/src/main/org/apache/tools/ant/taskdefs/CallTarget.java +++ b/src/main/org/apache/tools/ant/taskdefs/CallTarget.java @@ -187,9 +187,8 @@ public class CallTarget extends Task { throws IOException { if (callee != null) { return callee.handleInput(buffer, offset, length); - } else { - return super.handleInput(buffer, offset, length); } + return super.handleInput(buffer, offset, length); } /** diff --git a/src/main/org/apache/tools/ant/taskdefs/Concat.java b/src/main/org/apache/tools/ant/taskdefs/Concat.java index 0133b8aad..c7cf62197 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Concat.java +++ b/src/main/org/apache/tools/ant/taskdefs/Concat.java @@ -237,20 +237,20 @@ public class Concat extends Task { /** * Add a header to the concatenated output - * @param header the header + * @param headerToAdd the header * @since Ant 1.6 */ - public void addHeader(TextElement header) { - this.header = header; + public void addHeader(TextElement headerToAdd) { + this.header = headerToAdd; } /** * Add a footer to the concatenated output - * @param footer the footer + * @param footerToAdd the footer * @since Ant 1.6 */ - public void addFooter(TextElement footer) { - this.footer = footer; + public void addFooter(TextElement footerToAdd) { + this.footer = footerToAdd; } /** diff --git a/src/main/org/apache/tools/ant/taskdefs/Execute.java b/src/main/org/apache/tools/ant/taskdefs/Execute.java index d18b27ad7..e2da15bb3 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Execute.java +++ b/src/main/org/apache/tools/ant/taskdefs/Execute.java @@ -17,25 +17,30 @@ package org.apache.tools.ant.taskdefs; -import java.io.OutputStream; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileWriter; import java.io.IOException; +import java.io.OutputStream; import java.io.PrintWriter; import java.io.StringReader; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; +import java.util.Map; +import java.util.Set; import java.util.Vector; + import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; -import org.apache.tools.ant.util.FileUtils; import org.apache.tools.ant.taskdefs.condition.Os; import org.apache.tools.ant.types.Commandline; +import org.apache.tools.ant.util.FileUtils; +import org.apache.tools.ant.util.JavaEnvUtils; /** * Runs an external program. @@ -481,7 +486,8 @@ public class Execute { } return getExitValue(); } finally { - // remove the process to the list of those to destroy if the VM exits + // remove the process to the list of those to destroy if + // the VM exits // processDestroyer.remove(process); } @@ -506,8 +512,8 @@ public class Execute { try { Thread.sleep(1000); } catch (InterruptedException e) { - project.log("interruption in the sleep after having spawned a process", - Project.MSG_VERBOSE); + project.log("interruption in the sleep after having spawned a" + + " process", Project.MSG_VERBOSE); } } OutputStream dummyOut = new OutputStream() { @@ -521,7 +527,8 @@ public class Execute { handler.start(); process.getOutputStream().close(); - project.log("spawned process " + process.toString(), Project.MSG_VERBOSE); + project.log("spawned process " + process.toString(), + Project.MSG_VERBOSE); } /** @@ -645,7 +652,7 @@ public class Execute { /** * Close the streams belonging to the given Process. - * @param process the Process. + * @param process the Process. */ public static void closeStreams(Process process) { FileUtils.close(process.getInputStream()); @@ -717,7 +724,8 @@ public class Execute { * @param env The environment for the new process. If null, * the environment of the current process is used. * @return the created Process. - * @throws IOException if attempting to run a command in a specific directory. + * @throws IOException if attempting to run a command in a + * specific directory. */ public Process exec(Project project, String[] cmd, String[] env) throws IOException { @@ -771,7 +779,8 @@ public class Execute { * @param project the Ant project. * @param cmd the command line to execute as an array of strings. * @param env the environment to set as an array of strings. - * @param workingDir the working directory where the command should run. + * @param workingDir the working directory where the command + * should run. * @return the created Process. * @throws IOException probably forwarded from Runtime#exec. */ @@ -820,7 +829,8 @@ public class Execute { * @param cmd the command line to execute as an array of strings. * @param env the environment to set as an array of strings. * @return the created Process. - * @throws IOException forwarded from the exec method of the command launcher. + * @throws IOException forwarded from the exec method of the + * command launcher. */ public Process exec(Project project, String[] cmd, String[] env) throws IOException { @@ -849,7 +859,8 @@ public class Execute { * @param env the environment to set as an array of strings. * @param workingDir working directory where the command should run. * @return the created Process. - * @throws IOException forwarded from the exec method of the command launcher. + * @throws IOException forwarded from the exec method of the + * command launcher. */ public Process exec(Project project, String[] cmd, String[] env, File workingDir) throws IOException { @@ -897,7 +908,8 @@ public class Execute { * @param env the environment to set as an array of strings. * @param workingDir working directory where the command should run. * @return the created Process. - * @throws IOException forwarded from the exec method of the command launcher. + * @throws IOException forwarded from the exec method of the + * command launcher. */ public Process exec(Project project, String[] cmd, String[] env, File workingDir) throws IOException { @@ -942,7 +954,8 @@ public class Execute { * @param env the environment to set as an array of strings. * @param workingDir working directory where the command should run. * @return the created Process. - * @throws IOException forwarded from the exec method of the command launcher. + * @throws IOException forwarded from the exec method of the + * command launcher. */ public Process exec(Project project, String[] cmd, String[] env, File workingDir) throws IOException { @@ -976,7 +989,8 @@ public class Execute { * @param env the environment to set as an array of strings. * @param workingDir working directory where the command should run. * @return the created Process. - * @throws IOException forwarded from the exec method of the command launcher. + * @throws IOException forwarded from the exec method of the + * command launcher. */ public Process exec(Project project, String[] cmd, String[] env, File workingDir) throws IOException { @@ -993,7 +1007,8 @@ public class Execute { throw new IOException("Cannot locate antRun script: " + "Property 'ant.home' not found"); } - String antRun = project.resolveFile(antHome + File.separator + myScript).toString(); + String antRun = project.resolveFile(antHome + File.separator + + myScript).toString(); // Build the command File commandDir = workingDir; @@ -1032,7 +1047,8 @@ public class Execute { * @param env the environment to set as an array of strings. * @param workingDir working directory where the command should run. * @return the created Process. - * @throws IOException forwarded from the exec method of the command launcher. + * @throws IOException forwarded from the exec method of the + * command launcher. */ public Process exec(Project project, String[] cmd, String[] env, File workingDir) throws IOException { @@ -1049,7 +1065,8 @@ public class Execute { throw new IOException("Cannot locate antRun script: " + "Property 'ant.home' not found"); } - String antRun = project.resolveFile(antHome + File.separator + myScript).toString(); + String antRun = project.resolveFile(antHome + File.separator + + myScript).toString(); // Build the command File commandDir = workingDir; @@ -1083,7 +1100,8 @@ public class Execute { * @param cmd the command line to execute as an array of strings. * @param env the environment to set as an array of strings. * @return the created Process. - * @throws IOException forwarded from the exec method of the command launcher. + * @throws IOException forwarded from the exec method of the + * command launcher. */ public Process exec(Project project, String[] cmd, String[] env) throws IOException { @@ -1104,7 +1122,8 @@ public class Execute { * @param env the environment to set as an array of strings. * @param workingDir working directory where the command should run. * @return the created Process. - * @throws IOException forwarded from the exec method of the command launcher. + * @throws IOException forwarded from the exec method of the + * command launcher. */ public Process exec(Project project, String[] cmd, String[] env, File workingDir) throws IOException { diff --git a/src/main/org/apache/tools/ant/taskdefs/Exit.java b/src/main/org/apache/tools/ant/taskdefs/Exit.java index 2279cc10c..7d367846e 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Exit.java +++ b/src/main/org/apache/tools/ant/taskdefs/Exit.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2004 The Apache Software Foundation + * Copyright 2000-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,9 +37,9 @@ import org.apache.tools.ant.taskdefs.condition.ConditionBase; * are true. i.e. *
fail := defined(ifProperty) && !defined(unlessProperty)
* - * A single nested<condition> element can be specified - * instead of using if/unless (a combined - * effect can be achieved using isset conditions). + * A single nested<condition> element can be specified + * instead of using if/unless (a combined + * effect can be achieved using isset conditions). * * @since Ant 1.2 * @@ -90,17 +90,17 @@ public class Exit extends Task { /** * Set the status code to associate with the thrown Exception. - * @param i the int status + * @param i the int status */ public void setStatus(int i) { status = new Integer(i); } /** - * Throw a BuildException to exit (fail) the build. + * Throw a BuildException to exit (fail) the build. * If specified, evaluate conditions: * A single nested condition is accepted, but requires that the - * if/unless attributes be omitted. + * if/unless attributes be omitted. * If the nested condition evaluates to true, or the * ifCondition is true or unlessCondition is false, the build will exit. * The error message is constructed from the text fields, from @@ -156,7 +156,7 @@ public class Exit extends Task { /** * Add a condition element. - * @return ConditionBase. + * @return ConditionBase. * @since Ant 1.6.2 */ public ConditionBase createCondition() { @@ -207,10 +207,10 @@ public class Exit extends Task { /** * test whether there is a nested condition. - * @return boolean. + * @return boolean. */ private boolean nestedConditionPresent() { return (nestedCondition != null); } -} +} \ No newline at end of file diff --git a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java index 794dbb02a..0c9f9b8af 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java +++ b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java @@ -48,21 +48,21 @@ import org.apache.tools.ant.util.JavaEnvUtils; * Generates Javadoc documentation for a collection * of source code. * - *

Current known limitations are: + *

Current known limitations are: * - *

* - *

If no doclet is set, then the version and - * author are by default "yes". + *

If no doclet is set, then the version and + * author are by default "yes". * - *

Note: This task is run on another VM because the Javadoc code calls - * System.exit() which would break Ant functionality. + *

Note: This task is run on another VM because the Javadoc code calls + * System.exit() which would break Ant functionality. * * @since Ant 1.1 * @@ -270,6 +270,7 @@ public class Javadoc extends Task { * Default constructor */ public SourceFile() { + //empty } /** @@ -1190,8 +1191,8 @@ public class Javadoc extends Task { } /** - * Represents a link triplet (href, whether link is offline, location of the - * package list if off line) + * Represents a link triplet (href, whether link is offline, + * location of the package list if off line) */ public class LinkArgument { private String href; @@ -1199,6 +1200,7 @@ public class Javadoc extends Task { private File packagelistLoc; public LinkArgument() { + //empty } public void setHref(String hr) { @@ -1269,6 +1271,7 @@ public class Javadoc extends Task { /** Sole constructor. */ public TagArgument () { + //empty } /** @@ -1401,6 +1404,7 @@ public class Javadoc extends Task { private Vector packages = new Vector(); public GroupArgument() { + //empty } public void setTitle(String src) { @@ -1705,9 +1709,11 @@ public class Javadoc extends Task { if (la.isLinkOffline()) { File packageListLocation = la.getPackagelistLoc(); if (packageListLocation == null) { - throw new BuildException("The package list " - + " location for link " + la.getHref() - + " must be provided because the link is " + throw new BuildException("The package list" + + " location for link " + + la.getHref() + + " must be provided " + + "because the link is " + "offline"); } File packageListFile = @@ -1794,21 +1800,28 @@ public class Javadoc extends Task { // The tag element is not used as a fileset, // but specifies the tag directly. toExecute.createArgument().setValue ("-tag"); - toExecute.createArgument().setValue (ta.getParameter()); + toExecute.createArgument() + .setValue (ta.getParameter()); } else { - // The tag element is used as a fileset. Parse all the files and - // create -tag arguments. - DirectoryScanner tagDefScanner = ta.getDirectoryScanner(getProject()); + // The tag element is used as a + // fileset. Parse all the files and create + // -tag arguments. + DirectoryScanner tagDefScanner = + ta.getDirectoryScanner(getProject()); String[] files = tagDefScanner.getIncludedFiles(); for (int i = 0; i < files.length; i++) { File tagDefFile = new File(tagDir, files[i]); try { BufferedReader in - = new BufferedReader(new FileReader(tagDefFile)); + = new BufferedReader( + new FileReader(tagDefFile) + ); String line = null; while ((line = in.readLine()) != null) { - toExecute.createArgument().setValue ("-tag"); - toExecute.createArgument().setValue (line); + toExecute.createArgument() + .setValue("-tag"); + toExecute.createArgument() + .setValue(line); } in.close(); } catch (IOException ioe) { @@ -1870,8 +1883,8 @@ public class Javadoc extends Task { .setValue("@" + tmpList.getAbsolutePath()); } srcListWriter = new PrintWriter( - new FileWriter(tmpList.getAbsolutePath(), - true)); + new FileWriter(tmpList.getAbsolutePath(), + true)); } Enumeration e = packagesToDoc.elements(); @@ -1932,7 +1945,8 @@ public class Javadoc extends Task { exe.setCommandline(toExecute.getCommandline()); int ret = exe.execute(); if (ret != 0 && failOnError) { - throw new BuildException("Javadoc returned " + ret, getLocation()); + throw new BuildException("Javadoc returned " + ret, + getLocation()); } } catch (IOException e) { throw new BuildException("Javadoc failed: " + e, e, getLocation()); @@ -2113,4 +2127,4 @@ public class Javadoc extends Task { return getProject().replaceProperties(content); } -} +} \ No newline at end of file diff --git a/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java b/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java index 1f0c68107..e4ff40546 100644 --- a/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java +++ b/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java @@ -133,7 +133,7 @@ public class LoadProperties extends Task { } /** - * get the classpath used by this LoadProperties. + * get the classpath used by this LoadProperties. * @return The classpath */ public Path getClasspath() { @@ -252,5 +252,4 @@ public class LoadProperties extends Task { filterChains.addElement(filter); } -//end class -} +} \ No newline at end of file diff --git a/src/main/org/apache/tools/ant/taskdefs/condition/Http.java b/src/main/org/apache/tools/ant/taskdefs/condition/Http.java index 2a2088d83..46bdf82bc 100644 --- a/src/main/org/apache/tools/ant/taskdefs/condition/Http.java +++ b/src/main/org/apache/tools/ant/taskdefs/condition/Http.java @@ -1,5 +1,5 @@ /* - * Copyright 2001-2004 The Apache Software Foundation + * Copyright 2001-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,6 @@ public class Http extends ProjectComponent implements Condition { /** * Set the url attribute - * * @param url the url of the request */ public void setUrl(String url) { @@ -47,7 +46,6 @@ public class Http extends ProjectComponent implements Condition { /** * Set the errorsBeginAt attribute - * * @param errorsBeginAt number at which errors begin at, default is * 400 */ @@ -75,9 +73,8 @@ public class Http extends ProjectComponent implements Condition { Project.MSG_VERBOSE); if (code > 0 && code < errorsBeginAt) { return true; - } else { - return false; - } + } + return false; } } catch (java.io.IOException e) { return false; @@ -87,4 +84,4 @@ public class Http extends ProjectComponent implements Condition { } return true; } -} +} \ No newline at end of file diff --git a/src/main/org/apache/tools/ant/taskdefs/condition/IsSigned.java b/src/main/org/apache/tools/ant/taskdefs/condition/IsSigned.java index c6efe5a0e..682ce49a2 100644 --- a/src/main/org/apache/tools/ant/taskdefs/condition/IsSigned.java +++ b/src/main/org/apache/tools/ant/taskdefs/condition/IsSigned.java @@ -1,5 +1,5 @@ /* - * Copyright 2004 The Apache Software Foundation + * Copyright 2004-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,15 @@ */ package org.apache.tools.ant.taskdefs.condition; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.types.DataType; import java.io.File; import java.io.IOException; +import java.util.Enumeration; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; -import java.util.Enumeration; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.types.DataType; /** * Checks whether a jarfile is signed: if the name of the @@ -37,12 +38,11 @@ public class IsSigned extends DataType implements Condition { private static final String SIG_END = ".SF"; private String name; - private File file; + private File file; /** * The jarfile that is to be tested for the presence * of a signature. - * * @param file jarfile to be tested. */ public void setFile(File file) { @@ -51,7 +51,6 @@ public class IsSigned extends DataType implements Condition { /** * The signature name to check jarfile for. - * * @param name signature to look for. */ public void setName(String name) { @@ -59,8 +58,8 @@ public class IsSigned extends DataType implements Condition { } /** - * Returns true if the file exists and is signed with - * the signature specified, or, if name wasn't + * Returns true if the file exists and is signed with + * the signature specified, or, if name wasn't * specified, if the file contains a signature. * @return true if the file is signed. */ @@ -79,20 +78,19 @@ public class IsSigned extends DataType implements Condition { } } return false; - } else { - boolean shortSig = jarFile.getEntry(SIG_START - + name.toUpperCase() - + SIG_END) != null; - boolean longSig = false; - if (name.length() > 8) { - longSig = + } + boolean shortSig = jarFile.getEntry(SIG_START + + name.toUpperCase() + + SIG_END) != null; + boolean longSig = false; + if (name.length() > 8) { + longSig = jarFile.getEntry(SIG_START - + name.substring(0, 8).toUpperCase() - + SIG_END) != null; - } - - return shortSig || longSig; + + name.substring(0, 8).toUpperCase() + + SIG_END) != null; } + + return shortSig || longSig; } finally { if (jarFile != null) { try { @@ -105,8 +103,8 @@ public class IsSigned extends DataType implements Condition { } /** - * Returns true if the file exists and is signed with - * the signature specified, or, if name wasn't + * Returns true if the file exists and is signed with + * the signature specified, or, if name wasn't * specified, if the file contains a signature. * @return true if the file is signed. */ @@ -134,4 +132,4 @@ public class IsSigned extends DataType implements Condition { } return r; } -} +} \ No newline at end of file diff --git a/src/main/org/apache/tools/ant/taskdefs/condition/Os.java b/src/main/org/apache/tools/ant/taskdefs/condition/Os.java index 1e862d8bc..a23666c78 100644 --- a/src/main/org/apache/tools/ant/taskdefs/condition/Os.java +++ b/src/main/org/apache/tools/ant/taskdefs/condition/Os.java @@ -18,6 +18,7 @@ package org.apache.tools.ant.taskdefs.condition; import java.util.Locale; + import org.apache.tools.ant.BuildException; /** @@ -45,11 +46,11 @@ public class Os implements Condition { * */ public Os() { + //default } /** * Constructor that sets the family attribute - * * @param family a String value */ public Os(String family) { @@ -233,4 +234,4 @@ public class Os implements Condition { } return retValue; } -} +} \ No newline at end of file diff --git a/src/main/org/apache/tools/ant/taskdefs/condition/ParserSupports.java b/src/main/org/apache/tools/ant/taskdefs/condition/ParserSupports.java index 1cc486365..4266c7125 100644 --- a/src/main/org/apache/tools/ant/taskdefs/condition/ParserSupports.java +++ b/src/main/org/apache/tools/ant/taskdefs/condition/ParserSupports.java @@ -16,16 +16,17 @@ */ package org.apache.tools.ant.taskdefs.condition; -import org.apache.tools.ant.ProjectComponent; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; +import org.apache.tools.ant.ProjectComponent; import org.apache.tools.ant.util.JAXPUtils; -import org.xml.sax.XMLReader; + import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; +import org.xml.sax.XMLReader; /** - * test for the XML parser supporting a particular feature + * Test for the XML parser supporting a particular feature * @since Ant 1.7 */ public class ParserSupports extends ProjectComponent implements Condition { @@ -42,12 +43,13 @@ public class ParserSupports extends ProjectComponent implements Condition { " not recognized: "; private static final String NOT_SUPPORTED = " not supported: "; - public static final String ERROR_NO_ATTRIBUTES = "Neither feature or property are set"; - public static final String ERROR_NO_VALUE = "A value is needed when testing for property support"; + public static final String ERROR_NO_ATTRIBUTES = + "Neither feature or property are set"; + public static final String ERROR_NO_VALUE = + "A value is needed when testing for property support"; /** * Feature to probe for. - * * @param feature */ public void setFeature(String feature) { @@ -71,33 +73,30 @@ public class ParserSupports extends ProjectComponent implements Condition { this.value = value; } - - /** - * validate the args, then try to set the feature or property + * Validate the args, then try to set the feature or property * @return * @throws BuildException */ public boolean eval() throws BuildException { - if(feature!=null && property!=null) { + if (feature != null && property != null) { throw new BuildException(ERROR_BOTH_ATTRIBUTES); } - if(feature==null && property==null) { + if (feature == null && property == null) { throw new BuildException(ERROR_NO_ATTRIBUTES); } //pick a value that is good for everything - if(feature!=null) { + if (feature != null) { return evalFeature(); - } else { - if(value==null) { - throw new BuildException(ERROR_NO_VALUE); - } - return evalProperty(); } + if (value == null) { + throw new BuildException(ERROR_NO_VALUE); + } + return evalProperty(); } /** - * get our reader + * Get our reader * @return a reader */ private XMLReader getReader() { @@ -106,7 +105,7 @@ public class ParserSupports extends ProjectComponent implements Condition { } /** - * set a feature + * Set a feature * @return true if the feature could be set */ public boolean evalFeature() { @@ -116,7 +115,7 @@ public class ParserSupports extends ProjectComponent implements Condition { } boolean v= Project.toBoolean(value); try { - reader.setFeature(feature,v); + reader.setFeature(feature, v); } catch (SAXNotRecognizedException e) { log(FEATURE+NOT_RECOGNIZED+feature,Project.MSG_VERBOSE); return false; @@ -128,8 +127,7 @@ public class ParserSupports extends ProjectComponent implements Condition { } /** - * set a feature - * + * Set a property * @return true if the feature could be set */ public boolean evalProperty() { @@ -145,6 +143,4 @@ public class ParserSupports extends ProjectComponent implements Condition { } return true; } - - -} +} \ No newline at end of file diff --git a/src/main/org/apache/tools/ant/types/selectors/modifiedselector/EqualComparator.java b/src/main/org/apache/tools/ant/types/selectors/modifiedselector/EqualComparator.java index 301ab6d35..c4d3e592d 100644 --- a/src/main/org/apache/tools/ant/types/selectors/modifiedselector/EqualComparator.java +++ b/src/main/org/apache/tools/ant/types/selectors/modifiedselector/EqualComparator.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2004 The Apache Software Foundation + * Copyright 2003-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,12 +41,10 @@ public class EqualComparator implements Comparator { if (o1 == null) { if (o2 == null) { return 1; - } else { - return 0; } - } else { - return (o1.equals(o2)) ? 0 : 1; + return 0; } + return (o1.equals(o2)) ? 0 : 1; } /**