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