git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@565102 13f79535-47bb-0310-9956-ffa450edef68master
@@ -340,9 +340,9 @@ public class Available extends Task implements Condition { | |||||
// ** full-pathname specified == path in list | // ** full-pathname specified == path in list | ||||
// ** simple name specified == path in list | // ** simple name specified == path in list | ||||
if (path.exists() && | |||||
(filename.equals(paths[i]) | |||||
|| filename.equals(path.getName()))) { | |||||
if (path.exists() | |||||
&& (filename.equals(paths[i]) | |||||
|| filename.equals(path.getName()))) { | |||||
if (type == null) { | if (type == null) { | ||||
log("Found: " + path, Project.MSG_VERBOSE); | log("Found: " + path, Project.MSG_VERBOSE); | ||||
return true; | return true; | ||||
@@ -18,9 +18,6 @@ | |||||
package org.apache.tools.ant.taskdefs; | package org.apache.tools.ant.taskdefs; | ||||
import org.apache.tools.ant.Task; | |||||
import org.apache.tools.ant.TaskAdapter; | |||||
/** | /** | ||||
* Adds a compenent definition to the current project. | * Adds a compenent definition to the current project. | ||||
* used in the current project. Two attributes are needed, the name that identifies | * used in the current project. Two attributes are needed, the name that identifies | ||||
@@ -218,7 +218,7 @@ public class Concat extends Task implements ResourceCollection { | |||||
* The concatentated result can then be filtered as | * The concatentated result can then be filtered as | ||||
* a single stream. | * a single stream. | ||||
*/ | */ | ||||
private class MultiReader extends Reader { | |||||
private final class MultiReader extends Reader { | |||||
private Reader reader = null; | private Reader reader = null; | ||||
private int lastPos = 0; | private int lastPos = 0; | ||||
private char[] lastChars = new char[eolString.length()]; | private char[] lastChars = new char[eolString.length()]; | ||||
@@ -374,7 +374,7 @@ public class Concat extends Task implements ResourceCollection { | |||||
} | } | ||||
} | } | ||||
private class ConcatResource extends Resource { | |||||
private final class ConcatResource extends Resource { | |||||
private ResourceCollection c; | private ResourceCollection c; | ||||
private ConcatResource(ResourceCollection c) { | private ConcatResource(ResourceCollection c) { | ||||
@@ -618,7 +618,7 @@ public class Concat extends Task implements ResourceCollection { | |||||
newRc.setProject(getProject()); | newRc.setProject(getProject()); | ||||
newRc.add(rc); | newRc.add(rc); | ||||
rc = newRc; | rc = newRc; | ||||
} | |||||
} | |||||
((Resources) rc).add(c); | ((Resources) rc).add(c); | ||||
} | } | ||||
@@ -62,7 +62,7 @@ public class ConditionTask extends ConditionBase { | |||||
/** | /** | ||||
* The value for the property to set, if condition evaluates to true. | * The value for the property to set, if condition evaluates to true. | ||||
* Defaults to "true". | * Defaults to "true". | ||||
* @param v the (Object) value of the property | |||||
* @param value the (Object) value of the property | |||||
* @since Ant 1.8 | * @since Ant 1.8 | ||||
*/ | */ | ||||
public void setValue(Object value) { | public void setValue(Object value) { | ||||
@@ -82,7 +82,7 @@ public class ConditionTask extends ConditionBase { | |||||
/** | /** | ||||
* The value for the property to set, if condition evaluates to false. | * The value for the property to set, if condition evaluates to false. | ||||
* If this attribute is not specified, the property will not be set. | * If this attribute is not specified, the property will not be set. | ||||
* @param e the alternate value of the property. | |||||
* @param alt the alternate value of the property. | |||||
* @since Ant 1.8 | * @since Ant 1.8 | ||||
*/ | */ | ||||
public void setElse(Object alt) { | public void setElse(Object alt) { | ||||
@@ -28,7 +28,6 @@ import org.apache.tools.ant.types.FileList; | |||||
import org.apache.tools.ant.types.Resource; | import org.apache.tools.ant.types.Resource; | ||||
import org.apache.tools.ant.types.TimeComparison; | import org.apache.tools.ant.types.TimeComparison; | ||||
import org.apache.tools.ant.types.ResourceCollection; | import org.apache.tools.ant.types.ResourceCollection; | ||||
import org.apache.tools.ant.types.resources.Sort; | |||||
import org.apache.tools.ant.types.resources.Union; | import org.apache.tools.ant.types.resources.Union; | ||||
import org.apache.tools.ant.types.resources.Restrict; | import org.apache.tools.ant.types.resources.Restrict; | ||||
import org.apache.tools.ant.types.resources.Resources; | import org.apache.tools.ant.types.resources.Resources; | ||||
@@ -88,14 +87,15 @@ public class DependSet extends MatchingTask { | |||||
= new org.apache.tools.ant.types.resources.comparators.Date(); | = new org.apache.tools.ant.types.resources.comparators.Date(); | ||||
private static final ResourceComparator REVERSE_DATE = new Reverse(DATE); | private static final ResourceComparator REVERSE_DATE = new Reverse(DATE); | ||||
private static class NonExistent extends Restrict { | |||||
private static final class NonExistent extends Restrict { | |||||
private NonExistent(ResourceCollection rc) { | private NonExistent(ResourceCollection rc) { | ||||
super.add(rc); | super.add(rc); | ||||
super.add(NOT_EXISTS); | super.add(NOT_EXISTS); | ||||
} | } | ||||
} | } | ||||
private static class HideMissingBasedir implements ResourceCollection { | |||||
private static final class HideMissingBasedir | |||||
implements ResourceCollection { | |||||
private FileSet fs; | private FileSet fs; | ||||
private HideMissingBasedir(FileSet fs) { | private HideMissingBasedir(FileSet fs) { | ||||
@@ -131,7 +131,7 @@ public class Ear extends Jar { | |||||
|| !FILE_UTILS.fileNameEquals(deploymentDescriptor, file) | || !FILE_UTILS.fileNameEquals(deploymentDescriptor, file) | ||||
|| descriptorAdded) { | || descriptorAdded) { | ||||
log("Warning: selected " + archiveType | log("Warning: selected " + archiveType | ||||
+ " files include a "+ XML_DESCRIPTOR_PATH +" which will" | |||||
+ " files include a " + XML_DESCRIPTOR_PATH + " which will" | |||||
+ " be ignored (please use appxml attribute to " | + " be ignored (please use appxml attribute to " | ||||
+ archiveType + " task)", | + archiveType + " task)", | ||||
Project.MSG_WARN); | Project.MSG_WARN); | ||||
@@ -144,9 +144,10 @@ public class Expand extends Task { | |||||
log("expand complete", Project.MSG_VERBOSE); | log("expand complete", Project.MSG_VERBOSE); | ||||
} catch (IOException ioe) { | } catch (IOException ioe) { | ||||
throw new BuildException("Error while expanding " + srcF.getPath() | |||||
+"\n"+ioe.toString(), | |||||
ioe); | |||||
throw new BuildException( | |||||
"Error while expanding " + srcF.getPath() | |||||
+ "\n" + ioe.toString(), | |||||
ioe); | |||||
} finally { | } finally { | ||||
ZipFile.closeQuietly(zf); | ZipFile.closeQuietly(zf); | ||||
} | } | ||||
@@ -202,6 +202,7 @@ public class Java extends Task { | |||||
/** | /** | ||||
* Execute the specified CommandlineJava. | * Execute the specified CommandlineJava. | ||||
* @param commandLine CommandLineJava instance. | * @param commandLine CommandLineJava instance. | ||||
* @return the exit value of the process if forked, 0 otherwise. | |||||
*/ | */ | ||||
protected int executeJava(CommandlineJava commandLine) { | protected int executeJava(CommandlineJava commandLine) { | ||||
try { | try { | ||||
@@ -49,7 +49,7 @@ public class ManifestTask extends Task { | |||||
* Specifies the valid characters which can be used in attribute names. | * Specifies the valid characters which can be used in attribute names. | ||||
* {@value} | * {@value} | ||||
*/ | */ | ||||
public final String VALID_ATTRIBUTE_CHARS = | |||||
public static final String VALID_ATTRIBUTE_CHARS = | |||||
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012345679-_"; | "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012345679-_"; | ||||
/** | /** | ||||
@@ -105,7 +105,8 @@ public class ManifestTask extends Task { | |||||
throws ManifestException { | throws ManifestException { | ||||
Enumeration attributeKeys = section.getAttributeKeys(); | Enumeration attributeKeys = section.getAttributeKeys(); | ||||
while (attributeKeys.hasMoreElements()) { | while (attributeKeys.hasMoreElements()) { | ||||
Attribute attribute = section.getAttribute((String)attributeKeys.nextElement()); | |||||
Attribute attribute = section.getAttribute( | |||||
(String) attributeKeys.nextElement()); | |||||
checkAttribute(attribute); | checkAttribute(attribute); | ||||
} | } | ||||
nestedManifest.addConfiguredSection(section); | nestedManifest.addConfiguredSection(section); | ||||
@@ -93,11 +93,14 @@ public class Property extends Task { | |||||
this.map = map; | this.map = map; | ||||
} | } | ||||
// CheckStyle:LineLengthCheck OFF see to long | |||||
/* (non-Javadoc) | /* (non-Javadoc) | ||||
* @see org.apache.tools.ant.PropertyHelper.PropertyEvaluator#evaluate(java.lang.String, org.apache.tools.ant.PropertyHelper) | * @see org.apache.tools.ant.PropertyHelper.PropertyEvaluator#evaluate(java.lang.String, org.apache.tools.ant.PropertyHelper) | ||||
*/ | */ | ||||
// CheckStyle:LineLengthCheck ON | |||||
public Object evaluate(String property, PropertyHelper propertyHelper) { | public Object evaluate(String property, PropertyHelper propertyHelper) { | ||||
//our feeble properties don't matter if the PropertyHelper can resolve the property without us: | |||||
//our feeble properties don't matter if the PropertyHelper | |||||
// can resolve the property without us: | |||||
Stack stk = (Stack) getStack.get(); | Stack stk = (Stack) getStack.get(); | ||||
if (stk.contains(property)) { | if (stk.contains(property)) { | ||||
return null; | return null; | ||||
@@ -207,7 +210,7 @@ public class Property extends Task { | |||||
/** | /** | ||||
* Set the value of the property. | * Set the value of the property. | ||||
* @param value | |||||
* @param value the value to use. | |||||
*/ | */ | ||||
public void setValue(Object value) { | public void setValue(Object value) { | ||||
this.untypedValue = value; | this.untypedValue = value; | ||||
@@ -525,14 +528,15 @@ public class Property extends Task { | |||||
* @see http://java.sun.com/dtd/properties.dtd | * @see http://java.sun.com/dtd/properties.dtd | ||||
* @see java.util.Properties#loadFromXML(InputStream) | * @see java.util.Properties#loadFromXML(InputStream) | ||||
*/ | */ | ||||
private void loadProperties(Properties props, InputStream is, boolean isXml) throws IOException { | |||||
private void loadProperties( | |||||
Properties props, InputStream is, boolean isXml) throws IOException { | |||||
if (isXml) { | if (isXml) { | ||||
// load the xml based property definition | // load the xml based property definition | ||||
// use reflection because of bwc to Java 1.3 | // use reflection because of bwc to Java 1.3 | ||||
try { | try { | ||||
Method loadXmlMethod = props.getClass().getMethod("loadFromXML", | Method loadXmlMethod = props.getClass().getMethod("loadFromXML", | ||||
new Class[] { InputStream.class }); | |||||
loadXmlMethod.invoke(props, new Object[] { is }); | |||||
new Class[] {InputStream.class}); | |||||
loadXmlMethod.invoke(props, new Object[] {is}); | |||||
} catch (NoSuchMethodException e) { | } catch (NoSuchMethodException e) { | ||||
e.printStackTrace(); | e.printStackTrace(); | ||||
log("Can not load xml based property definition on Java < 5"); | log("Can not load xml based property definition on Java < 5"); | ||||
@@ -38,7 +38,7 @@ public class PropertyHelperTask extends Task { | |||||
/** | /** | ||||
* Nested delegate for refid usage. | * Nested delegate for refid usage. | ||||
*/ | */ | ||||
public class DelegateElement { | |||||
public final class DelegateElement { | |||||
private String refid; | private String refid; | ||||
private DelegateElement() { | private DelegateElement() { | ||||
@@ -40,18 +40,20 @@ public class Retry extends Task implements TaskContainer { | |||||
/** | /** | ||||
* set the task | * set the task | ||||
* @param t the task to retry. | |||||
*/ | */ | ||||
public synchronized void addTask(Task t) { | public synchronized void addTask(Task t) { | ||||
if (nestedTask != null) { | if (nestedTask != null) { | ||||
throw new BuildException("The retry task container accepts a single nested task" | |||||
+ " (which may be a sequential task container)"); | |||||
throw new BuildException( | |||||
"The retry task container accepts a single nested task" | |||||
+ " (which may be a sequential task container)"); | |||||
} | } | ||||
nestedTask = t; | nestedTask = t; | ||||
} | } | ||||
/** | /** | ||||
* set the number of times to retry the task | * set the number of times to retry the task | ||||
* @param n | |||||
* @param n the number to use. | |||||
*/ | */ | ||||
public void setRetryCount(int n) { | public void setRetryCount(int n) { | ||||
retryCount = n; | retryCount = n; | ||||
@@ -59,6 +61,7 @@ public class Retry extends Task implements TaskContainer { | |||||
/** | /** | ||||
* perform the work | * perform the work | ||||
* @throws BuildException if there is an error. | |||||
*/ | */ | ||||
public void execute() throws BuildException { | public void execute() throws BuildException { | ||||
StringBuffer errorMessages = new StringBuffer(); | StringBuffer errorMessages = new StringBuffer(); | ||||
@@ -523,7 +523,8 @@ public class Rmic extends MatchingTask { | |||||
scanDir(baseDir, files, adapter.getMapper()); | scanDir(baseDir, files, adapter.getMapper()); | ||||
} else { | } else { | ||||
// otherwise perform a timestamp comparison - at least | // otherwise perform a timestamp comparison - at least | ||||
scanDir(baseDir, new String[] { classname.replace('.', File.separatorChar) | |||||
scanDir(baseDir, new String[] { | |||||
classname.replace('.', File.separatorChar) | |||||
+ ".class" }, adapter.getMapper()); | + ".class" }, adapter.getMapper()); | ||||
} | } | ||||
int fileCount = compileList.size(); | int fileCount = compileList.size(); | ||||
@@ -611,7 +612,8 @@ public class Rmic extends MatchingTask { | |||||
protected void scanDir(File baseDir, String[] files, FileNameMapper mapper) { | protected void scanDir(File baseDir, String[] files, FileNameMapper mapper) { | ||||
String[] newFiles = files; | String[] newFiles = files; | ||||
if (idl) { | if (idl) { | ||||
log("will leave uptodate test to rmic implementation in idl mode.", Project.MSG_VERBOSE); | |||||
log("will leave uptodate test to rmic implementation in idl mode.", | |||||
Project.MSG_VERBOSE); | |||||
} else if (iiop && iiopOpts != null && iiopOpts.indexOf("-always") > -1) { | } else if (iiop && iiopOpts != null && iiopOpts.indexOf("-always") > -1) { | ||||
log("no uptodate test as -always option has been specified", Project.MSG_VERBOSE); | log("no uptodate test as -always option has been specified", Project.MSG_VERBOSE); | ||||
} else { | } else { | ||||
@@ -84,7 +84,7 @@ public class Truncate extends Task { | |||||
/** | /** | ||||
* Set the length to which files should be set. | * Set the length to which files should be set. | ||||
* It is permissible to append K / M / G / T / P. | * It is permissible to append K / M / G / T / P. | ||||
* @param adjust (positive) adjustment amount. | |||||
* @param length (positive) adjustment amount. | |||||
*/ | */ | ||||
public void setLength(Long length) { | public void setLength(Long length) { | ||||
this.length = length; | this.length = length; | ||||
@@ -272,7 +272,8 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||||
String[] dirs; | String[] dirs; | ||||
String baseMessage = | String baseMessage = | ||||
"specify the stylesheet either as a filename in style attribute or as a nested resource"; | |||||
"specify the stylesheet either as a filename in style attribute " | |||||
+ "or as a nested resource"; | |||||
if (xslResource == null && xslFile == null) { | if (xslResource == null && xslFile == null) { | ||||
throw new BuildException(baseMessage, getLocation()); | throw new BuildException(baseMessage, getLocation()); | ||||
@@ -306,7 +307,8 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||||
* the wrong version has been used. | * the wrong version has been used. | ||||
*/ | */ | ||||
if (stylesheet.exists()) { | if (stylesheet.exists()) { | ||||
log("DEPRECATED - the 'style' attribute should be relative to the project's"); | |||||
log("DEPRECATED - the 'style' attribute should be " | |||||
+ "relative to the project's"); | |||||
log(" basedir, not the tasks's basedir."); | log(" basedir, not the tasks's basedir."); | ||||
} | } | ||||
} | } | ||||
@@ -1010,7 +1012,8 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||||
* | * | ||||
* @since Ant 1.7 | * @since Ant 1.7 | ||||
*/ | */ | ||||
private void setLiaisonDynamicFileParameters(XSLTLiaison liaison, File inFile) throws Exception { | |||||
private void setLiaisonDynamicFileParameters( | |||||
XSLTLiaison liaison, File inFile) throws Exception { | |||||
if (fileNameParameter != null) { | if (fileNameParameter != null) { | ||||
liaison.addParam(fileNameParameter, inFile.getName()); | liaison.addParam(fileNameParameter, inFile.getName()); | ||||
} | } | ||||
@@ -362,8 +362,10 @@ public class XmlProperty extends org.apache.tools.ant.Task { | |||||
String nodeName = attributeNode.getNodeName(); | String nodeName = attributeNode.getNodeName(); | ||||
String attributeValue = getAttributeValue(attributeNode); | String attributeValue = getAttributeValue(attributeNode); | ||||
Path containingPath = container != null && container instanceof Path ? (Path) container | |||||
: null; | |||||
Path containingPath = | |||||
((container != null) && (container instanceof Path)) | |||||
? (Path) container | |||||
: null; | |||||
/* | /* | ||||
* The main conditional logic -- if the attribute | * The main conditional logic -- if the attribute | ||||
* is somehow "special" (i.e., it has known | * is somehow "special" (i.e., it has known | ||||