Sorry for the giant pile of changes. Tests pass for me; does anyone object
to my merging these to master?
Matt
On Thu, Apr 13, 2017 at 10:16 AM, wrote:
> http://git-wip-us.apache.org/repos/asf/ant/blob/b7d1e9bd/
> src/main/org/apache/tools/ant/taskdefs/Java.java
> --
> diff --git a/src/main/org/apache/tools/ant/taskdefs/Java.java
> b/src/main/org/apache/tools/ant/taskdefs/Java.java
> index ed9f906..b4b5a7e 100644
> --- a/src/main/org/apache/tools/ant/taskdefs/Java.java
> +++ b/src/main/org/apache/tools/ant/taskdefs/Java.java
> @@ -20,8 +20,6 @@ package org.apache.tools.ant.taskdefs;
>
> import java.io.File;
> import java.io.IOException;
> -import java.io.PrintWriter;
> -import java.io.StringWriter;
> import java.util.Vector;
>
> import org.apache.tools.ant.BuildException;
> @@ -52,6 +50,8 @@ import org.apache.tools.ant.util.StringUtils;
> * @ant.task category="java"
> */
> public class Java extends Task {
> +private static final String TIMEOUT_MESSAGE =
> +"Timeout: killed the sub-process";
>
> private CommandlineJava cmdl = new CommandlineJava();
> private Environment env = new Environment();
> @@ -78,9 +78,6 @@ public class Java extends Task {
> private boolean spawn = false;
> private boolean incompatibleWithSpawn = false;
>
> -private static final String TIMEOUT_MESSAGE =
> -"Timeout: killed the sub-process";
> -
> /**
> * Normal constructor
> */
> @@ -100,6 +97,7 @@ public class Java extends Task {
> * @throws BuildException if failOnError is set to true and the
> application
> * returns a nonzero result code.
> */
> +@Override
> public void execute() throws BuildException {
> File savedDir = dir;
> Permissions savedPermissions = perm;
> @@ -148,30 +146,32 @@ public class Java extends Task {
> throw new BuildException("Classname must not be null.");
> }
> if (!fork && getCommandLine().getJar() != null) {
> -throw new BuildException("Cannot execute a jar in non-forked
> mode."
> - + " Please set fork='true'. ");
> +throw new BuildException(
> +"Cannot execute a jar in non-forked mode. Please set
> fork='true'. ");
> }
> if (!fork && getCommandLine().getModule() != null) {
> -throw new BuildException("Cannot execute a module in
> non-forked mode."
> - + " Please set fork='true'. ");
> +throw new BuildException(
> +"Cannot execute a module in non-forked mode. Please set
> fork='true'. ");
> }
> if (spawn && !fork) {
> -throw new BuildException("Cannot spawn a java process in
> non-forked mode."
> - + " Please set fork='true'. ");
> +throw new BuildException(
> +"Cannot spawn a java process in non-forked mode. Please
> set fork='true'. ");
> }
> if (getCommandLine().getClasspath() != null
> && getCommandLine().getJar() != null) {
> -log("When using 'jar' attribute classpath-settings are
> ignored. "
> -+ "See the manual for more information.",
> Project.MSG_VERBOSE);
> +log("When using 'jar' attribute classpath-settings are
> ignored. See the manual for more information.",
> +Project.MSG_VERBOSE);
> }
> if (spawn && incompatibleWithSpawn) {
> -getProject().log("spawn does not allow attributes related to
> input, "
> -+ "output, error, result", Project.MSG_ERR);
> +getProject().log(
> +"spawn does not allow attributes related to input,
> output, error, result",
> +Project.MSG_ERR);
> getProject().log("spawn also does not allow timeout",
> Project.MSG_ERR);
> -getProject().log("finally, spawn is not compatible "
> -+ "with a nested I/O ", Project.MSG_ERR);
> -throw new BuildException("You have used an attribute "
> -+ "or nested element which is not compatible with spawn");
> +getProject().log(
> +"finally, spawn is not compatible with a nested I/O
> ",
> +Project.MSG_ERR);
> +throw new BuildException(
> +"You have used an attribute or nested element which is
> not compatible with spawn");
> }
> if (getCommandLine().getAssertions() != null && !fork) {
> log("Assertion statements are currently ignored in non-forked
> mode");
> @@ -191,8 +191,8 @@ public class Java extends Task {
> Project.MSG_WARN);
> }
> if (newEnvironment || null != env.getVariables()) {
> -log("Changes to environment variables are ignored