bodewig 02/04/11 08:59:38
Modified: src/main/org/apache/tools/ant/taskdefs ExecTask.java
ExecuteStreamHandler.java ExecuteWatchdog.java
Javadoc.java LogOutputStream.java
LogStreamHandler.java MatchingTask.java
PumpStreamHandler.java
Log:
<javadoc> added some options to the not-cloned Commandline potentially
adding them several times of execute would be called more than once.
Cosmetics.
Revision Changes Path
1.34 +6 -2
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/ExecTask.java
Index: ExecTask.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/ExecTask.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- ExecTask.java 11 Apr 2002 07:18:44 -0000 1.33
+++ ExecTask.java 11 Apr 2002 15:59:37 -0000 1.34
@@ -78,6 +78,8 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Stefan Bodewig</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Mariusz Nowostawski</a>
*
+ * @since Ant 1.2
+ *
* @ant.task category="control"
*/
public class ExecTask extends Task {
@@ -259,10 +261,12 @@
throw new BuildException("no executable specified", location);
}
if (dir != null && !dir.exists()) {
- throw new BuildException("The directory you specified does not
exist");
+ throw new BuildException("The directory you specified does not "
+ + "exist");
}
if (dir != null && !dir.isDirectory()) {
- throw new BuildException("The directory you specified is not a
directory");
+ throw new BuildException("The directory you specified is not a "
+ + "directory");
}
}
1.4 +2 -1
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/ExecuteStreamHandler.java
Index: ExecuteStreamHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/ExecuteStreamHandler.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ExecuteStreamHandler.java 13 Sep 2001 08:40:37 -0000 1.3
+++ ExecuteStreamHandler.java 11 Apr 2002 15:59:37 -0000 1.4
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * Copyright (c) 2000,2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -63,6 +63,7 @@
* subprocesses.
*
* @author [EMAIL PROTECTED]
+ * @since Ant 1.2
*/
public interface ExecuteStreamHandler {
1.9 +1 -0
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java
Index: ExecuteWatchdog.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ExecuteWatchdog.java 5 Apr 2002 12:56:34 -0000 1.8
+++ ExecuteWatchdog.java 11 Apr 2002 15:59:37 -0000 1.9
@@ -75,6 +75,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Stephane Bailliez</a>
* @see Execute
* @see org.apache.tools.ant.util.Watchdog
+ * @since Ant 1.2
*/
public class ExecuteWatchdog implements TimeoutObserver {
1.87 +93 -66
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
Index: Javadoc.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javadoc.java,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -r1.86 -r1.87
--- Javadoc.java 8 Apr 2002 16:11:27 -0000 1.86
+++ Javadoc.java 11 Apr 2002 15:59:37 -0000 1.87
@@ -102,6 +102,8 @@
* @author Ernst de Haan <a href="mailto:[EMAIL PROTECTED]">[EMAIL
PROTECTED]</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Stefan Bodewig</a>
*
+ * @since Ant 1.1
+ *
* @ant.task category="java"
*/
@@ -225,12 +227,12 @@
private Commandline cmd = new Commandline();
private static boolean javadoc1 =
- (JavaEnvUtils.getJavaVersion() == Project.JAVA_1_1);
+ (JavaEnvUtils.getJavaVersion() == JavaEnvUtils.JAVA_1_1);
private static boolean javadoc4 =
- (JavaEnvUtils.getJavaVersion() != Project.JAVA_1_1 &&
- JavaEnvUtils.getJavaVersion() != Project.JAVA_1_2 &&
- JavaEnvUtils.getJavaVersion() != Project.JAVA_1_3);
+ (JavaEnvUtils.getJavaVersion() != JavaEnvUtils.JAVA_1_1 &&
+ JavaEnvUtils.getJavaVersion() != JavaEnvUtils.JAVA_1_2 &&
+ JavaEnvUtils.getJavaVersion() != JavaEnvUtils.JAVA_1_3);
private void addArgIf(boolean b, String arg) {
if (b) {
@@ -244,9 +246,8 @@
cmd.createArgument().setValue(key);
cmd.createArgument().setValue(value);
} else {
- project.log(this,
- "Warning: Leaving out empty argument '" + key +
"'",
- Project.MSG_WARN);
+ log("Warning: Leaving out empty argument '" + key + "'",
+ Project.MSG_WARN);
}
}
}
@@ -569,8 +570,9 @@
if (!javadoc1) {
LinkArgument le = createLink();
le.setOffline(true);
- String linkOfflineError = "The linkoffline attribute must
include a URL and " +
- "a package-list file location separated by a space";
+ String linkOfflineError = "The linkoffline attribute must
include"
+ + " an URL and a package-list file location separated by a"
+ + " space";
if (src.trim().length() == 0) {
throw new BuildException(linkOfflineError);
}
@@ -679,8 +681,8 @@
*/
public TagArgument createTag() {
if (!javadoc4) {
- project.log ("-tag option not supported on JavaDoc < 1.4",
- Project.MSG_VERBOSE);
+ log ("-tag option not supported on JavaDoc < 1.4",
+ Project.MSG_VERBOSE);
}
TagArgument ta = new TagArgument();
tags.addElement (ta);
@@ -694,7 +696,8 @@
*/
static final String[] SCOPE_ELEMENTS = {
"overview", "packages", "types", "constructors",
- "methods", "fields"};
+ "methods", "fields"
+ };
/**
* Class representing a -tag argument.
@@ -749,9 +752,10 @@
* Must not be <code>null</code>,
* should not be empty.
*
- * @exception BuildException if all is specified along with other
elements,
- * if any elements are repeated, if no elements are specified,
- * or if any unrecognised elements are specified.
+ * @exception BuildException if all is specified along with
+ * other elements, if any elements are repeated, if no
+ * elements are specified, or if any unrecognised elements are
+ * specified.
*/
public void setScope (String verboseScope) throws BuildException {
verboseScope=verboseScope.toLowerCase (Locale.US);
@@ -780,12 +784,13 @@
break;
}
if (i==SCOPE_ELEMENTS.length) {
- throw new BuildException ("Unrecognised scope
element: "+next);
+ throw new BuildException ("Unrecognised scope
element: "
+ + next);
}
else {
if (elements[i]) {
- getProject().log ("Repeated tag scope element:
"+next,
- Project.MSG_VERBOSE);
+ getProject().log ("Repeated tag scope element: "
+ + next, Project.MSG_VERBOSE);
}
elements[i]=true;
gotNotAll=true;
@@ -794,11 +799,12 @@
}
if (gotNotAll && gotAll) {
- throw new BuildException ("Mixture of \"all\" and other
scope elements "+
- "in tag parameter.");
+ throw new BuildException ("Mixture of \"all\" and other
scope "
+ + "elements in tag parameter.");
}
if (!gotNotAll && !gotAll) {
- throw new BuildException ("No scope elements specified in
tag parameter.");
+ throw new BuildException ("No scope elements specified in
tag "
+ + "parameter.");
}
if (gotAll) {
this.scope="a";
@@ -912,7 +918,7 @@
* the 1.4 version or a different doclet than the standard doclet
* is used.
*
- * @since 1.86, Ant 1.5
+ * @since Ant 1.5
*/
public void setSource(String source) {
this.source = source;
@@ -930,27 +936,27 @@
log("Generating Javadoc", Project.MSG_INFO);
+ Commandline toExecute = (Commandline)cmd.clone();
+ toExecute.setExecutable(JavaEnvUtils.getJdkExecutable("javadoc"));
+
+// ------------------------------------------------ general javadoc arguments
if (doctitle != null) {
- cmd.createArgument().setValue("-doctitle");
- cmd.createArgument().setValue(expand(doctitle.getText()));
+ toExecute.createArgument().setValue("-doctitle");
+ toExecute.createArgument().setValue(expand(doctitle.getText()));
}
if (header != null) {
- cmd.createArgument().setValue("-header");
- cmd.createArgument().setValue(expand(header.getText()));
+ toExecute.createArgument().setValue("-header");
+ toExecute.createArgument().setValue(expand(header.getText()));
}
if (footer != null) {
- cmd.createArgument().setValue("-footer");
- cmd.createArgument().setValue(expand(footer.getText()));
+ toExecute.createArgument().setValue("-footer");
+ toExecute.createArgument().setValue(expand(footer.getText()));
}
if (bottom != null) {
- cmd.createArgument().setValue("-bottom");
- cmd.createArgument().setValue(expand(bottom.getText()));
+ toExecute.createArgument().setValue("-bottom");
+ toExecute.createArgument().setValue(expand(bottom.getText()));
}
- Commandline toExecute = (Commandline)cmd.clone();
- toExecute.setExecutable(JavaEnvUtils.getJdkExecutable("javadoc"));
-
-// ------------------------------------------------ general javadoc arguments
if (classpath == null) {
classpath = Path.systemClasspath;
} else {
@@ -964,8 +970,10 @@
toExecute.createArgument().setPath(sourcePath);
} else {
toExecute.createArgument().setValue("-classpath");
- toExecute.createArgument().setValue(sourcePath.toString() +
-
System.getProperty("path.separator") + classpath.toString());
+ toExecute.createArgument()
+ .setValue(sourcePath.toString()
+ + System.getProperty("path.separator")
+ + classpath.toString());
}
if (version && doclet == null) {
@@ -982,15 +990,13 @@
}
}
-
// --------------------------------- javadoc2 arguments for default doclet
-// XXX: how do we handle a custom doclet?
-
if (!javadoc1) {
if (doclet != null) {
if (doclet.getName() == null) {
- throw new BuildException("The doclet name must be
specified.", location);
+ throw new BuildException("The doclet name must be "
+ + "specified.", location);
}
else {
toExecute.createArgument().setValue("-doclet");
@@ -1003,15 +1009,18 @@
toExecute.createArgument().setPath(docletPath);
}
}
- for (Enumeration e = doclet.getParams();
e.hasMoreElements();) {
+ for (Enumeration e = doclet.getParams();
+ e.hasMoreElements();) {
DocletParam param = (DocletParam)e.nextElement();
if (param.getName() == null) {
- throw new BuildException("Doclet parameters must
have a name");
+ throw new BuildException("Doclet parameters must
"
+ + "have a name");
}
toExecute.createArgument().setValue(param.getName());
if (param.getValue() != null) {
-
toExecute.createArgument().setValue(param.getValue());
+ toExecute.createArgument()
+ .setValue(param.getValue());
}
}
}
@@ -1027,24 +1036,33 @@
LinkArgument la = (LinkArgument)e.nextElement();
if (la.getHref() == null) {
- throw new BuildException("Links must provide the URL
to the external class documentation.");
+ throw new BuildException("Links must provide the URL
"
+ + "to the external class "
+ + "documentation.");
}
if (la.isLinkOffline()) {
File packageListLocation = la.getPackagelistLoc();
if (packageListLocation == null) {
- throw new BuildException("The package list
location for link " + la.getHref() +
- " must be provided
because the link is offline");
+ throw new BuildException("The package list "
+ + " location for link "
+ + la.getHref()
+ + " must be provided "
+ + "because the link is "
+ + "offline");
}
- File packageList = new File(packageListLocation,
"package-list");
+ File packageList =
+ new File(packageListLocation, "package-list");
if (packageList.exists()) {
toExecute.createArgument().setValue("-linkoffline");
toExecute.createArgument().setValue(la.getHref());
-
toExecute.createArgument().setValue(packageListLocation.getAbsolutePath());
+ toExecute.createArgument()
+ .setValue(packageListLocation
+ .getAbsolutePath());
}
else {
- log("Warning: No package list was found at " +
packageListLocation,
- Project.MSG_VERBOSE);
+ log("Warning: No package list was found at "
+ + packageListLocation, Project.MSG_VERBOSE);
}
}
else {
@@ -1087,7 +1105,9 @@
String title = ga.getTitle();
String packages = ga.getPackages();
if (title == null || packages == null) {
- throw new BuildException("The title and packages
must be specified for group elements.");
+ throw new BuildException("The title and packages
must "
+ + "be specified for group "
+ + "elements.");
}
toExecute.createArgument().setValue("-group");
toExecute.createArgument().setValue(expand(title));
@@ -1104,15 +1124,16 @@
toExecute.createArgument().setValue ("-tag");
toExecute.createArgument().setValue
(ta.getParameter());
} else {
- ExtensionInfo tagletInfo
- = (ExtensionInfo) element;
+ ExtensionInfo tagletInfo = (ExtensionInfo) element;
toExecute.createArgument().setValue("-taglet");
-
toExecute.createArgument().setValue(tagletInfo.getName());
+ toExecute.createArgument().setValue(tagletInfo
+ .getName());
if (tagletInfo.getPath() != null) {
- Path tagletPath
- =
tagletInfo.getPath().concatSystemClasspath("ignore");
+ Path tagletPath = tagletInfo.getPath()
+ .concatSystemClasspath("ignore");
if (tagletPath.size() != 0) {
-
toExecute.createArgument().setValue("-tagletpath");
+ toExecute.createArgument()
+ .setValue("-tagletpath");
toExecute.createArgument().setPath(tagletPath);
}
}
@@ -1155,7 +1176,8 @@
}
}
if (packages.size() > 0) {
- evaluatePackages(toExecute, sourcePath, packages,
excludePackages);
+ evaluatePackages(toExecute, sourcePath, packages,
+ excludePackages);
}
}
@@ -1169,10 +1191,13 @@
if (useExternalFile) {
if (tmpList == null) {
tmpList = fileUtils.createTempFile("javadoc", "",
null);
- toExecute.createArgument().setValue("@" +
tmpList.getAbsolutePath());
+ toExecute.createArgument()
+ .setValue("@" + tmpList.getAbsolutePath());
}
- srcListWriter = new PrintWriter(new
FileWriter(tmpList.getAbsolutePath(),
- true));
+ srcListWriter = new PrintWriter(
+ new FileWriter(tmpList
+ .getAbsolutePath(),
+ true));
}
Enumeration enum = sourceFiles.elements();
@@ -1270,7 +1295,7 @@
String[] list = sourcePath.list();
if (list == null) {
- list = new String[0];
+ list = new String[0];
}
FileSet fs = new FileSet();
@@ -1302,11 +1327,11 @@
try {
if (useExternalFile) {
tmpList = fileUtils.createTempFile("javadoc", "", null);
- toExecute.createArgument().setValue("@" +
tmpList.getAbsolutePath());
+ toExecute.createArgument()
+ .setValue("@" + tmpList.getAbsolutePath());
packageListWriter = new PrintWriter(new FileWriter(tmpList));
}
-
for (int j=0; j<list.length; j++) {
File source = project.resolveFile(list[j]);
fs.setDir(source);
@@ -1326,7 +1351,8 @@
});
if (files.length > 0) {
- String pkgDir =
packageDirs[i].replace('/','.').replace('\\','.');
+ String pkgDir =
+
packageDirs[i].replace('/','.').replace('\\','.');
if (!addedPackages.contains(pkgDir)) {
if (useExternalFile) {
packageListWriter.println(pkgDir);
@@ -1360,7 +1386,8 @@
//
private String queuedLine = null;
protected void processLine(String line, int messageLevel) {
- if (messageLevel == Project.MSG_INFO &&
line.startsWith("Generating ")) {
+ if (messageLevel == Project.MSG_INFO
+ && line.startsWith("Generating ")) {
if (queuedLine != null) {
super.processLine(queuedLine, Project.MSG_VERBOSE);
}
1.6 +2 -1
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/LogOutputStream.java
Index: LogOutputStream.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/LogOutputStream.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- LogOutputStream.java 10 Jan 2002 13:59:31 -0000 1.5
+++ LogOutputStream.java 11 Apr 2002 15:59:37 -0000 1.6
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2000-2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -70,6 +70,7 @@
* of data written to the stream.
*
* @author [EMAIL PROTECTED]
+ * @since Ant 1.2
*/
public class LogOutputStream extends OutputStream {
1.5 +2 -4
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/LogStreamHandler.java
Index: LogStreamHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/LogStreamHandler.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- LogStreamHandler.java 28 Oct 2001 21:26:29 -0000 1.4
+++ LogStreamHandler.java 11 Apr 2002 15:59:37 -0000 1.5
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * Copyright (c) 2000,2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -55,17 +55,15 @@
package org.apache.tools.ant.taskdefs;
import org.apache.tools.ant.BuildException;
-
import org.apache.tools.ant.Task;
-
-
import java.io.IOException;
/**
* Logs standard output and error of a subprocess to the log system of ant.
*
* @author [EMAIL PROTECTED]
+ * @since Ant 1.2
*/
public class LogStreamHandler extends PumpStreamHandler {
1.22 +3 -1
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java
Index: MatchingTask.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- MatchingTask.java 10 Apr 2002 11:27:16 -0000 1.21
+++ MatchingTask.java 11 Apr 2002 15:59:37 -0000 1.22
@@ -72,6 +72,7 @@
* @author Sam Ruby <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>
* @author Jon S. Stevens <a href="mailto:[EMAIL PROTECTED]">[EMAIL
PROTECTED]</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Stefan Bodewig</a>
+ * @since Ant 1.1
*/
public abstract class MatchingTask extends Task {
@@ -178,7 +179,8 @@
"Please use the excludes attribute.",
Project.MSG_WARN);
if (ignoreString != null && ignoreString.length() > 0) {
- StringTokenizer tok = new StringTokenizer(ignoreString, ", ",
false);
+ StringTokenizer tok = new StringTokenizer(ignoreString, ", ",
+ false);
while (tok.hasMoreTokens()) {
createExclude().setName("**/"+tok.nextToken().trim()+"/**");
}
1.5 +4 -2
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java
Index: PumpStreamHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- PumpStreamHandler.java 10 Jan 2002 13:59:31 -0000 1.4
+++ PumpStreamHandler.java 11 Apr 2002 15:59:37 -0000 1.5
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2000-2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -65,6 +65,7 @@
* TODO: standard input of the subprocess is not implemented.
*
* @author [EMAIL PROTECTED]
+ * @since Ant 1.2
*/
public class PumpStreamHandler implements ExecuteStreamHandler {
@@ -139,7 +140,8 @@
/**
- * Creates a stream pumper to copy the given input stream to the given
output stream.
+ * Creates a stream pumper to copy the given input stream to the
+ * given output stream.
*/
protected Thread createPump(InputStream is, OutputStream os) {
final Thread result = new Thread(new StreamPumper(is, os));
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>