On OpenVMS the Java VM will exit with a return code of 0 on success, even though this is going to signal a failure for the OS. All tasks that spawn new VMs have now been reverted to explicitly check for retCode != 0 instead of Execite.isFailure(retCode). We could as well introduce Execute#isJavaFailure or something like this in case future VM's on OpenVMS will start to do the right thing. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275005 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -20,13 +20,22 @@ Windows executable and is not aware of Cygwin conventions. | |||||
| </p> | </p> | ||||
| <h4>OpenVMS Users</h4> | <h4>OpenVMS Users</h4> | ||||
| <p>The command specified using <code>executable</code> and <code><arg></code> | |||||
| elements is executed exactly as specified inside a temporary DCL script. This means | |||||
| that paths have to be written in VMS style. It is also required that the logical | |||||
| <code>JAVA$FORK_SUPPORT_CHDIR</code> is set to <code>TRUE</code> (see the <i>JDK Release | |||||
| Notes</i>). | |||||
| </p> | |||||
| <p>The command specified using <code>executable</code> and | |||||
| <code><arg></code> elements is executed exactly as specified | |||||
| inside a temporary DCL script. This means that paths have to be | |||||
| written in VMS style. It is also required that the logical | |||||
| <code>JAVA$FORK_SUPPORT_CHDIR</code> is set to <code>TRUE</code> (see | |||||
| the <i>JDK Release Notes</i>).</p> | |||||
| <p>Please note that the Java VM provided by HP doesn't follow OpenVMS' | |||||
| conventions of exit codes. If you run a Java VM with this task, the | |||||
| task may falsely claim that an error occured (or silently ignore an | |||||
| error). Don't use this task to run <code>JAVA.EXE</code>, use a | |||||
| <code><java></code> task with the <code>fork</code> attribute | |||||
| set ti <code>true</code> instead as this task will follow the VM's | |||||
| interpretation of exit codes.</p> | |||||
| <h3>Parameters</h3> | <h3>Parameters</h3> | ||||
| <table border="1" cellpadding="2" cellspacing="0"> | <table border="1" cellpadding="2" cellspacing="0"> | ||||
| <tr> | <tr> | ||||
| @@ -577,6 +577,15 @@ public class Execute { | |||||
| /** | /** | ||||
| * Checks whether <code>exitValue</code> signals a failure on the current | * Checks whether <code>exitValue</code> signals a failure on the current | ||||
| * system (OS specific). | * system (OS specific). | ||||
| * | |||||
| * <p><b>Note</b> that this method relies on the conventions of | |||||
| * the OS, it will return false results if the application you are | |||||
| * running doesn't follow these conventions. One notable | |||||
| * exception is the Java VM provided by HP for OpenVMS - it will | |||||
| * return 0 if successful (like on any other platform), but this | |||||
| * signals a failure on OpenVMS. So if you execute a new Java VM | |||||
| * on OpenVMS, you cannot trust this method.</p> | |||||
| * | |||||
| * @param exitValue the exit value (return code) to be checked | * @param exitValue the exit value (return code) to be checked | ||||
| * @return <code>true</code> if <code>exitValue</code> signals a failure | * @return <code>true</code> if <code>exitValue</code> signals a failure | ||||
| */ | */ | ||||
| @@ -109,7 +109,7 @@ public class Java extends Task { | |||||
| int err = -1; | int err = -1; | ||||
| try { | try { | ||||
| err = executeJava(); | err = executeJava(); | ||||
| if (fork && Execute.isFailure(err)) { | |||||
| if (fork && err != 0) { | |||||
| if (failOnError) { | if (failOnError) { | ||||
| throw new BuildException("Java returned: " + err, getLocation()); | throw new BuildException("Java returned: " + err, getLocation()); | ||||
| } else { | } else { | ||||
| @@ -1984,7 +1984,7 @@ public class Javadoc extends Task { | |||||
| try { | try { | ||||
| exe.setCommandline(toExecute.getCommandline()); | exe.setCommandline(toExecute.getCommandline()); | ||||
| int ret = exe.execute(); | int ret = exe.execute(); | ||||
| if (Execute.isFailure(ret) && 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) { | ||||
| @@ -318,7 +318,7 @@ public class ANTLR extends Task { | |||||
| log(commandline.describeCommand(), Project.MSG_VERBOSE); | log(commandline.describeCommand(), Project.MSG_VERBOSE); | ||||
| int err = run(commandline.getCommandline()); | int err = run(commandline.getCommandline()); | ||||
| if (Execute.isFailure(err)) { | |||||
| if (err != 0) { | |||||
| throw new BuildException("ANTLR returned: " + err, getLocation()); | throw new BuildException("ANTLR returned: " + err, getLocation()); | ||||
| } else { | } else { | ||||
| String output = bos.toString(); | String output = bos.toString(); | ||||
| @@ -198,7 +198,7 @@ public class CCMCheck extends Continuus { | |||||
| checkOptions(commandLine); | checkOptions(commandLine); | ||||
| int result = run(commandLine); | int result = run(commandLine); | ||||
| if (Execute.isFailure(0)) { | |||||
| if (Execute.isFailure(result)) { | |||||
| String msg = "Failed executing: " + commandLine.toString(); | String msg = "Failed executing: " + commandLine.toString(); | ||||
| throw new BuildException(msg, getLocation()); | throw new BuildException(msg, getLocation()); | ||||
| } | } | ||||
| @@ -194,7 +194,7 @@ public class JJDoc extends Task { | |||||
| process.setCommandline(cmdl.getCommandline()); | process.setCommandline(cmdl.getCommandline()); | ||||
| try { | try { | ||||
| if (Execute.isFailure(process.execute())) { | |||||
| if (process.execute() != 0) { | |||||
| throw new BuildException("JJDoc failed."); | throw new BuildException("JJDoc failed."); | ||||
| } | } | ||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| @@ -290,7 +290,7 @@ public class JJTree extends Task { | |||||
| process.setCommandline(cmdl.getCommandline()); | process.setCommandline(cmdl.getCommandline()); | ||||
| try { | try { | ||||
| if (Execute.isFailure(process.execute())) { | |||||
| if (process.execute() != 0) { | |||||
| throw new BuildException("JJTree failed."); | throw new BuildException("JJTree failed."); | ||||
| } | } | ||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| @@ -246,7 +246,7 @@ public abstract class AbstractMetamataTask extends Task { | |||||
| log(cmdl.describeCommand(), Project.MSG_VERBOSE); | log(cmdl.describeCommand(), Project.MSG_VERBOSE); | ||||
| process.setCommandline(cmdl.getCommandline()); | process.setCommandline(cmdl.getCommandline()); | ||||
| try { | try { | ||||
| if (Execute.isFailure(process.execute())) { | |||||
| if (process.execute() != 0) { | |||||
| throw new BuildException("Metamata task failed."); | throw new BuildException("Metamata task failed."); | ||||
| } | } | ||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| @@ -183,7 +183,7 @@ public class MParse extends AbstractMetamataTask { | |||||
| log(cmdl.describeCommand(), Project.MSG_VERBOSE); | log(cmdl.describeCommand(), Project.MSG_VERBOSE); | ||||
| process.setCommandline(cmdl.getCommandline()); | process.setCommandline(cmdl.getCommandline()); | ||||
| try { | try { | ||||
| if (Execute.isFailure(process.execute())) { | |||||
| if (process.execute() != 0) { | |||||
| throw new BuildException("Metamata task failed."); | throw new BuildException("Metamata task failed."); | ||||
| } | } | ||||
| } catch (IOException e) { | } catch (IOException e) { | ||||