git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@476580 13f79535-47bb-0310-9956-ffa450edef68master
@@ -36,6 +36,9 @@ import org.apache.tools.bzip2.CBZip2OutputStream; | |||
*/ | |||
public class BZip2 extends Pack { | |||
/** | |||
* Compress the zipFile. | |||
*/ | |||
protected void pack() { | |||
CBZip2OutputStream zOut = null; | |||
try { | |||
@@ -59,7 +59,7 @@ import org.apache.tools.ant.util.StringUtils; | |||
*/ | |||
public class Checksum extends MatchingTask implements Condition { | |||
private static class FileUnion extends Restrict { | |||
Union u; | |||
private Union u; | |||
FileUnion() { | |||
u = new Union(); | |||
super.add(u); | |||
@@ -52,6 +52,9 @@ public class Chmod extends ExecuteOn { | |||
} | |||
/** | |||
* Set the project of this task. | |||
* Calls the super class and sets the project on dhe default FileSet. | |||
* @param project the project for this task. | |||
* @see org.apache.tools.ant.ProjectComponent#setProject | |||
*/ | |||
public void setProject(Project project) { | |||
@@ -95,17 +95,26 @@ public class Classloader extends Task { | |||
this.reset = b; | |||
} | |||
/** | |||
* Set reverse attribute. | |||
* @param b if true reverse the normal classloader lookup. | |||
*/ | |||
public void setReverse(boolean b) { | |||
this.parentFirst = !b; | |||
} | |||
/** | |||
* Set reverse attribute. | |||
* @param b if true reverse the normal classloader lookup. | |||
*/ | |||
public void setParentFirst(boolean b) { | |||
this.parentFirst = b; | |||
} | |||
// TODO: add exceptions for delegation or reverse | |||
// TODO | |||
/** | |||
* Set the name of the parent. | |||
* @param name the parent name. | |||
*/ | |||
public void setParentName(String name) { | |||
this.parentName = name; | |||
} | |||
@@ -114,6 +123,8 @@ public class Classloader extends Task { | |||
/** Specify which path will be used. If the loader already exists | |||
* and is an AntClassLoader (or any other loader we can extend), | |||
* the path will be added to the loader. | |||
* @param pathRef a reference to a path. | |||
* @throws BuildException if there is a problem. | |||
*/ | |||
public void setClasspathRef(Reference pathRef) throws BuildException { | |||
classpath = (Path) pathRef.getReferencedObject(getProject()); | |||
@@ -132,6 +143,10 @@ public class Classloader extends Task { | |||
} | |||
} | |||
/** | |||
* Create a classpath. | |||
* @return a path for configuration. | |||
*/ | |||
public Path createClasspath() { | |||
if (this.classpath == null) { | |||
this.classpath = new Path(null); | |||
@@ -140,6 +155,9 @@ public class Classloader extends Task { | |||
} | |||
/** | |||
* do the classloader manipulation. | |||
*/ | |||
public void execute() { | |||
try { | |||
// Gump friendly - don't mess with the core loader if only classpath | |||
@@ -116,10 +116,22 @@ public class CopyPath extends Task { | |||
return path; | |||
} | |||
/** | |||
* Set the number of milliseconds leeway to give before deciding a | |||
* target is out of date. | |||
* TODO: This is not yet used. | |||
* @param granularity the granularity used to decide if a target is out of | |||
* date. | |||
*/ | |||
public void setGranularity(long granularity) { | |||
this.granularity = granularity; | |||
} | |||
/** | |||
* Give the copied files the same last modified time as the original files. | |||
* @param preserveLastModified if true preserve the modified time; | |||
* default is false. | |||
*/ | |||
public void setPreserveLastModified(boolean preserveLastModified) { | |||
this.preserveLastModified = preserveLastModified; | |||
} | |||
@@ -83,8 +83,8 @@ public class Delete extends MatchingTask { | |||
return ((Comparable) foo).compareTo(bar) * -1; | |||
} | |||
}; | |||
File basedir; | |||
String[] dirs; | |||
private File basedir; | |||
private String[] dirs; | |||
ReverseDirs(File basedir, String[] dirs) { | |||
this.basedir = basedir; | |||
this.dirs = dirs; | |||
@@ -68,6 +68,7 @@ public class ExecuteWatchdog implements TimeoutObserver { | |||
} | |||
/** | |||
* @param timeout the timeout value to use in milliseconds. | |||
* @see #ExecuteWatchdog(long) | |||
* @deprecated since 1.5.x. | |||
* Use constructor with a long type instead. | |||
@@ -343,22 +343,26 @@ public class Get extends Task { | |||
extends org.apache.tools.ant.util.Base64Converter { | |||
} | |||
/** | |||
* Interface implemented for reporting | |||
* progess of downloading. | |||
*/ | |||
public interface DownloadProgress { | |||
/** | |||
* begin a download | |||
*/ | |||
public void beginDownload(); | |||
void beginDownload(); | |||
/** | |||
* tick handler | |||
* | |||
*/ | |||
public void onTick(); | |||
void onTick(); | |||
/** | |||
* end a download | |||
*/ | |||
public void endDownload(); | |||
void endDownload(); | |||
} | |||
/** | |||
@@ -393,8 +397,14 @@ public class Get extends Task { | |||
*/ | |||
public static class VerboseProgress implements DownloadProgress { | |||
private int dots = 0; | |||
// CheckStyle:VisibilityModifier OFF - bc | |||
PrintStream out; | |||
// CheckStyle:VisibilityModifier ON | |||
/** | |||
* Construct a verbose progress reporter. | |||
* @param out the output stream. | |||
*/ | |||
public VerboseProgress(PrintStream out) { | |||
this.out = out; | |||
} | |||
@@ -127,7 +127,7 @@ public class Input extends Task { | |||
new PropertyFileInputHandler(), | |||
new GreedyInputHandler()}; | |||
//inherit doc | |||
/** {@inheritDoc} */ | |||
public String[] getValues() { | |||
return VALUES; | |||
} | |||
@@ -144,11 +144,13 @@ public class Jar extends Zip { | |||
* | |||
* @since Ant 1.6.3 | |||
*/ | |||
private ZipExtraField[] JAR_MARKER = new ZipExtraField[] { | |||
private static final ZipExtraField[] JAR_MARKER = new ZipExtraField[] { | |||
JarMarker.getInstance() | |||
}; | |||
// CheckStyle:VisibilityModifier OFF - bc | |||
protected String emptyBehavior = "create"; | |||
// CheckStyle:VisibilityModifier ON | |||
/** constructor */ | |||
public Jar() { | |||
@@ -261,11 +261,15 @@ public class Length extends Task implements Condition { | |||
} | |||
private abstract class Handler { | |||
PrintStream ps; | |||
private PrintStream ps; | |||
Handler(PrintStream ps) { | |||
this.ps = ps; | |||
} | |||
protected PrintStream getPs() { | |||
return ps; | |||
} | |||
protected abstract void handle(Resource r); | |||
void complete() { | |||
@@ -278,14 +282,14 @@ public class Length extends Task implements Condition { | |||
super(ps); | |||
} | |||
protected void handle(Resource r) { | |||
ps.print(r.toString()); | |||
ps.print(" : "); | |||
getPs().print(r.toString()); | |||
getPs().print(" : "); | |||
//when writing to the log, we'll see what's happening: | |||
long size = r.getSize(); | |||
if (size == Resource.UNKNOWN_SIZE) { | |||
ps.println("unknown"); | |||
getPs().println("unknown"); | |||
} else { | |||
ps.println(size); | |||
getPs().println(size); | |||
} | |||
} | |||
} | |||
@@ -295,6 +299,9 @@ public class Length extends Task implements Condition { | |||
AllHandler(PrintStream ps) { | |||
super(ps); | |||
} | |||
protected long getAccum() { | |||
return accum; | |||
} | |||
protected synchronized void handle(Resource r) { | |||
long size = r.getSize(); | |||
if (size == Resource.UNKNOWN_SIZE) { | |||
@@ -304,7 +311,7 @@ public class Length extends Task implements Condition { | |||
} | |||
} | |||
void complete() { | |||
ps.print(accum); | |||
getPs().print(accum); | |||
super.complete(); | |||
} | |||
} | |||
@@ -316,7 +323,7 @@ public class Length extends Task implements Condition { | |||
void complete() { | |||
} | |||
long getLength() { | |||
return accum; | |||
return getAccum(); | |||
} | |||
} | |||
} |
@@ -51,10 +51,9 @@ public class LoadResource extends Task { | |||
private boolean failOnError = true; | |||
/** | |||
* suppress error message if it goes pear-shaped, sets failOnError=false | |||
* suppress error message if it goes pear-shaped, sets failOnError=false | |||
*/ | |||
private boolean quiet = false; | |||
/** | |||
* Encoding to use for filenames, defaults to the platform's default | |||
@@ -106,7 +105,7 @@ public class LoadResource extends Task { | |||
public final void setFailonerror(final boolean fail) { | |||
failOnError = fail; | |||
} | |||
/** | |||
* If true, suppress the load error report and set the | |||
* the failonerror value to false. | |||
@@ -116,6 +116,7 @@ public abstract class MatchingTask extends Task implements SelectorContainer { | |||
fileset.setIncludes(includes); | |||
} | |||
// CheckStyle:MethodNameCheck OFF - bc | |||
/** | |||
* Set this to be the items in the base directory that you want to be | |||
* included. You can also specify "*" for the items (ie: items="*") | |||
@@ -168,6 +169,8 @@ public abstract class MatchingTask extends Task implements SelectorContainer { | |||
} | |||
} | |||
// CheckStyle:VisibilityModifier ON | |||
/** | |||
* Sets whether default exclusions should be used or not. | |||
* | |||
@@ -58,8 +58,8 @@ public class Redirector { | |||
= System.getProperty("file.encoding"); | |||
private class PropertyOutputStream extends ByteArrayOutputStream { | |||
String property; | |||
boolean closed = false; | |||
private String property; | |||
private boolean closed = false; | |||
PropertyOutputStream(String property) { | |||
super(); | |||
@@ -46,6 +46,7 @@ import org.apache.tools.ant.util.FileNameMapper; | |||
* @since Ant 1.1 | |||
*/ | |||
public class SignJar extends AbstractJarSignerTask { | |||
// CheckStyle:VisibilityModifier OFF - bc | |||
private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); | |||
@@ -131,6 +132,7 @@ public class SignJar extends AbstractJarSignerTask { | |||
* error string for unit test verification: {@value} | |||
*/ | |||
public static final String ERROR_NO_STOREPASS = "storepass attribute must be set"; | |||
// CheckStyle:VisibilityModifier ON | |||
/** | |||
* name of .SF/.DSA file; optional | |||
@@ -125,6 +125,7 @@ public class StreamPumper implements Runnable { | |||
/** | |||
* This method blocks until the stream pumper finishes. | |||
* @throws InterruptedException if interrupted. | |||
* @see #isFinished() | |||
*/ | |||
public synchronized void waitFor() | |||
@@ -62,6 +62,8 @@ public class Sync extends Task { | |||
// Override Task#init | |||
/** | |||
* Initialize the sync task. | |||
* @throws BuildException if there is a problem. | |||
* @see Task#init() | |||
*/ | |||
public void init() | |||
@@ -85,6 +87,8 @@ public class Sync extends Task { | |||
// Override Task#execute | |||
/** | |||
* Execute the sync task. | |||
* @throws BuildException if there is an error. | |||
* @see Task#execute() | |||
*/ | |||
public void execute() | |||
@@ -368,6 +372,7 @@ public class Sync extends Task { | |||
/** | |||
* @see Copy#scan(File, File, String[], String[]) | |||
*/ | |||
/** {@inheritDoc} */ | |||
protected void scan(File fromDir, File toDir, String[] files, | |||
String[] dirs) { | |||
assertTrue("No mapper", mapperElement == null); | |||
@@ -385,6 +390,7 @@ public class Sync extends Task { | |||
/** | |||
* @see Copy#scan(Resource[], File) | |||
*/ | |||
/** {@inheritDoc} */ | |||
protected Map scan(Resource[] resources, File toDir) { | |||
assertTrue("No mapper", mapperElement == null); | |||
@@ -90,6 +90,7 @@ public class Tar extends MatchingTask { | |||
*/ | |||
public static final String OMIT = "omit"; | |||
// CheckStyle:VisibilityModifier OFF - bc | |||
File tarFile; | |||
File baseDir; | |||
@@ -103,6 +104,8 @@ public class Tar extends MatchingTask { | |||
Vector fileSetFiles = new Vector(); | |||
// CheckStyle:VisibilityModifier ON | |||
/** | |||
* Indicates whether the user has been warned about long files already. | |||
*/ | |||
@@ -668,6 +671,7 @@ public class Tar extends MatchingTask { | |||
/** | |||
* whether the given resource collection is a (subclass of) | |||
* FileSet that only contains file system resources. | |||
* @param rc the resource collection to check. | |||
* @return true if the collection is a fileset. | |||
* @since Ant 1.7 | |||
*/ | |||
@@ -678,6 +682,7 @@ public class Tar extends MatchingTask { | |||
/** | |||
* Grabs all included files and directors from the FileSet and | |||
* returns them as an array of (relative) file names. | |||
* @param fs the fileset to operate on. | |||
* @return a list of the filenames. | |||
* @since Ant 1.7 | |||
*/ | |||
@@ -33,10 +33,11 @@ import org.apache.tools.ant.types.resources.FileResource; | |||
*/ | |||
public abstract class Unpack extends Task { | |||
// CheckStyle:VisibilityModifier OFF - bc | |||
protected File source; | |||
protected File dest; | |||
protected Resource srcResource; | |||
// CheckStyle:VisibilityModifier ON | |||
/** | |||
* @deprecated since 1.5.x. | |||
@@ -91,6 +91,7 @@ public class Untar extends Expand { | |||
/** | |||
* @see Expand#expandFile(FileUtils, File, File) | |||
*/ | |||
/** {@inheritDoc} */ | |||
protected void expandFile(FileUtils fileUtils, File srcF, File dir) { | |||
FileInputStream fis = null; | |||
try { | |||
@@ -53,7 +53,9 @@ public class UpToDate extends Task implements Condition { | |||
private Vector sourceFileSets = new Vector(); | |||
private Union sourceResources = new Union(); | |||
// CheckStyle:VisibilityModifier OFF - bc | |||
protected Mapper mapperElement = null; | |||
// CheckStyle:VisibilityModifier ON | |||
/** | |||
* The property to set if the target file is more up-to-date than | |||
@@ -55,6 +55,7 @@ public class VerifyJar extends AbstractJarSignerTask { | |||
*/ | |||
private boolean certificates = false; | |||
private BufferingOutputFilter outputCache = new BufferingOutputFilter(); | |||
/** Error output if there is a failure to verify the jar. */ | |||
public static final String ERROR_NO_VERIFY = "Failed to verify "; | |||
/** | |||
@@ -179,11 +179,17 @@ public class WaitFor extends ConditionBase { | |||
*/ | |||
public static class Unit extends EnumeratedAttribute { | |||
/** millisecond string */ | |||
public static final String MILLISECOND = "millisecond"; | |||
/** second string */ | |||
public static final String SECOND = "second"; | |||
/** minute string */ | |||
public static final String MINUTE = "minute"; | |||
/** hour string */ | |||
public static final String HOUR = "hour"; | |||
/** day string */ | |||
public static final String DAY = "day"; | |||
/** week string */ | |||
public static final String WEEK = "week"; | |||
private static final String[] UNITS = { | |||
@@ -215,6 +221,7 @@ public class WaitFor extends ConditionBase { | |||
/** | |||
* @see EnumeratedAttribute#getValues() | |||
*/ | |||
/** {@inheritDoc} */ | |||
public String[] getValues() { | |||
return UNITS; | |||
} | |||
@@ -216,7 +216,10 @@ public class War extends Jar { | |||
* gets executed. | |||
*/ | |||
protected void cleanUp() { | |||
if (addedWebXmlFile == null && deploymentDescriptor==null && needxmlfile && !isInUpdateMode()) { | |||
if (addedWebXmlFile == null | |||
&& deploymentDescriptor == null | |||
&& needxmlfile | |||
&& !isInUpdateMode()) { | |||
throw new BuildException("No WEB-INF/web.xml file was added.\n" | |||
+ "If this is your intent, set needxml='false' "); | |||
} | |||
@@ -69,7 +69,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||
private String fileNameParameter = null; | |||
/** name for XSL parameter containing the file directory */ | |||
public String fileDirParameter = null; | |||
private String fileDirParameter = null; | |||
/** additional parameters to be passed to the stylesheets */ | |||
private Vector params = new Vector(); | |||
@@ -1658,6 +1658,7 @@ public class Zip extends MatchingTask { | |||
/** | |||
* @see EnumeratedAttribute#getValues() | |||
*/ | |||
/** {@inheritDoc} */ | |||
public String[] getValues() { | |||
return new String[] {"add", "preserve", "fail"}; | |||
} | |||
@@ -42,23 +42,35 @@ import org.apache.tools.ant.util.FileUtils; | |||
* It produces an XML output representing the list of changes. | |||
* <pre> | |||
* <font color=#0000ff><!-- Root element --></font> | |||
* <font color=#6a5acd><!ELEMENT</font> changelog <font color=#ff00ff>(entry</font><font color=#ff00ff>+</font><font color=#ff00ff>)</font><font color=#6a5acd>></font> | |||
* <font color=#6a5acd><!ELEMENT</font> changelog <font color=#ff00ff> | |||
* (entry</font><font color=#ff00ff>+</font><font color=#ff00ff>) | |||
* </font><font color=#6a5acd>></font> | |||
* <font color=#0000ff><!-- CVS Entry --></font> | |||
* <font color=#6a5acd><!ELEMENT</font> entry <font color=#ff00ff>(date,author,file</font><font color=#ff00ff>+</font><font color=#ff00ff>,msg)</font><font color=#6a5acd>></font> | |||
* <font color=#6a5acd><!ELEMENT</font> entry <font color=#ff00ff> | |||
* (date,author,file</font><font color=#ff00ff>+</font><font color=#ff00ff>,msg) | |||
* </font><font color=#6a5acd>></font> | |||
* <font color=#0000ff><!-- Date of cvs entry --></font> | |||
* <font color=#6a5acd><!ELEMENT</font> date <font color=#ff00ff>(#PCDATA)</font><font color=#6a5acd>></font> | |||
* <font color=#6a5acd><!ELEMENT</font> date <font color=#ff00ff>(#PCDATA) | |||
* </font><font color=#6a5acd>></font> | |||
* <font color=#0000ff><!-- Author of change --></font> | |||
* <font color=#6a5acd><!ELEMENT</font> author <font color=#ff00ff>(#PCDATA)</font><font color=#6a5acd>></font> | |||
* <font color=#6a5acd><!ELEMENT</font> author <font color=#ff00ff>(#PCDATA) | |||
* </font><font color=#6a5acd>></font> | |||
* <font color=#0000ff><!-- List of files affected --></font> | |||
* <font color=#6a5acd><!ELEMENT</font> msg <font color=#ff00ff>(#PCDATA)</font><font color=#6a5acd>></font> | |||
* <font color=#6a5acd><!ELEMENT</font> msg <font color=#ff00ff>(#PCDATA) | |||
* </font><font color=#6a5acd>></font> | |||
* <font color=#0000ff><!-- File changed --></font> | |||
* <font color=#6a5acd><!ELEMENT</font> file <font color=#ff00ff>(name,revision,prevrevision</font><font color=#ff00ff>?</font><font color=#ff00ff>)</font><font color=#6a5acd>></font> | |||
* <font color=#6a5acd><!ELEMENT</font> file <font color=#ff00ff> | |||
* (name,revision,prevrevision</font><font color=#ff00ff>?</font> | |||
* <font color=#ff00ff>)</font><font color=#6a5acd>></font> | |||
* <font color=#0000ff><!-- Name of the file --></font> | |||
* <font color=#6a5acd><!ELEMENT</font> name <font color=#ff00ff>(#PCDATA)</font><font color=#6a5acd>></font> | |||
* <font color=#6a5acd><!ELEMENT</font> name <font color=#ff00ff>(#PCDATA) | |||
* </font><font color=#6a5acd>></font> | |||
* <font color=#0000ff><!-- Revision number --></font> | |||
* <font color=#6a5acd><!ELEMENT</font> revision <font color=#ff00ff>(#PCDATA)</font><font color=#6a5acd>></font> | |||
* <font color=#6a5acd><!ELEMENT</font> revision <font color=#ff00ff> | |||
* (#PCDATA)</font><font color=#6a5acd>></font> | |||
* <font color=#0000ff><!-- Previous revision number --></font> | |||
* <font color=#6a5acd><!ELEMENT</font> prevrevision <font color=#ff00ff>(#PCDATA)</font><font color=#6a5acd>></font> | |||
* <font color=#6a5acd><!ELEMENT</font> prevrevision <font color=#ff00ff> | |||
* (#PCDATA)</font><font color=#6a5acd>></font> | |||
* </pre> | |||
* | |||
* @since Ant 1.5 | |||
@@ -98,7 +98,7 @@ public class EmailTask extends Task { | |||
/** Password for SMTP auth */ | |||
private String password = null; | |||
/** indicate if the user wishes SSL-TLS */ | |||
private boolean SSL = false; | |||
private boolean ssl = false; | |||
/** | |||
* Set the user for SMTP auth; this requires JavaMail. | |||
@@ -120,11 +120,11 @@ public class EmailTask extends Task { | |||
/** | |||
* Set whether to send data over SSL. | |||
* @param SSL boolean; if true SSL will be used. | |||
* @param ssl boolean; if true SSL will be used. | |||
* @since Ant 1.6 | |||
*/ | |||
public void setSSL(boolean SSL) { | |||
this.SSL = SSL; | |||
public void setSSL(boolean ssl) { | |||
this.ssl = ssl; | |||
} | |||
/** | |||
@@ -360,7 +360,7 @@ public class EmailTask extends Task { | |||
/** | |||
* Creates a Path as container for attachments. Supports any | |||
* filesystem resource-collections that way. | |||
* | |||
* @return the path to be configured. | |||
* @since Ant 1.7 | |||
*/ | |||
public Path createAttachments() { | |||
@@ -432,7 +432,7 @@ public class EmailTask extends Task { | |||
throw new BuildException("SMTP auth only possible with MIME mail"); | |||
} | |||
// SSL only allowed with MIME mail | |||
if (autoFound == false && (SSL) | |||
if (!autoFound && (ssl) | |||
&& (encoding.equals(UU) || encoding.equals(PLAIN))) { | |||
throw new BuildException("SSL only possible with MIME mail"); | |||
} | |||
@@ -518,7 +518,7 @@ public class EmailTask extends Task { | |||
mailer.setPort(port); | |||
mailer.setUser(user); | |||
mailer.setPassword(password); | |||
mailer.setSSL(SSL); | |||
mailer.setSSL(ssl); | |||
mailer.setMessage(message); | |||
mailer.setFrom(from); | |||
mailer.setReplyToList(replyToList); | |||
@@ -559,6 +559,7 @@ public class EmailTask extends Task { | |||
* Sets the character set of mail message. | |||
* Will be ignored if mimeType contains ....; Charset=... substring or | |||
* encoding is not a <code>mime</code>. | |||
* @param charset the character encoding to use. | |||
* @since Ant 1.6 | |||
*/ | |||
public void setCharset(String charset) { | |||
@@ -58,6 +58,8 @@ import org.apache.tools.ant.BuildException; | |||
* @since Ant 1.5 | |||
*/ | |||
public class MimeMailer extends Mailer { | |||
private final static String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory"; | |||
/** Default character set */ | |||
private static final String DEFAULT_CHARSET | |||
= System.getProperty("file.encoding"); | |||
@@ -145,7 +147,6 @@ public class MimeMailer extends Mailer { | |||
+ "security provider, check that you have JSSE in " | |||
+ "your classpath"); | |||
} | |||
final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory"; | |||
// SMTP provider | |||
props.put("mail.smtp.socketFactory.class", SSL_FACTORY); | |||
props.put("mail.smtp.socketFactory.fallback", "false"); | |||