You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2003/08/01 12:08:13 UTC
cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/metamata AbstractMetamataTask.java MParse.java
bodewig 2003/08/01 03:08:13
Modified: docs/manual/CoreTasks exec.html
src/main/org/apache/tools/ant/taskdefs Execute.java
Java.java Javadoc.java
src/main/org/apache/tools/ant/taskdefs/optional ANTLR.java
src/main/org/apache/tools/ant/taskdefs/optional/ccm
CCMCheck.java
src/main/org/apache/tools/ant/taskdefs/optional/javacc
JJDoc.java JJTree.java
src/main/org/apache/tools/ant/taskdefs/optional/metamata
AbstractMetamataTask.java MParse.java
Log:
Revert part of the commit that made tasks use Execute#isFailure.
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.
Revision Changes Path
1.31 +15 -6 ant/docs/manual/CoreTasks/exec.html
Index: exec.html
===================================================================
RCS file: /home/cvs/ant/docs/manual/CoreTasks/exec.html,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- exec.html 30 Jul 2003 10:32:43 -0000 1.30
+++ exec.html 1 Aug 2003 10:08:12 -0000 1.31
@@ -20,13 +20,22 @@
</p>
<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>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
1.63 +10 -1 ant/src/main/org/apache/tools/ant/taskdefs/Execute.java
Index: Execute.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Execute.java,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -r1.62 -r1.63
--- Execute.java 28 Jul 2003 10:39:30 -0000 1.62
+++ Execute.java 1 Aug 2003 10:08:12 -0000 1.63
@@ -577,6 +577,15 @@
/**
* Checks whether <code>exitValue</code> signals a failure on the current
* 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
* @return <code>true</code> if <code>exitValue</code> signals a failure
*/
1.69 +1 -1 ant/src/main/org/apache/tools/ant/taskdefs/Java.java
Index: Java.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Java.java,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- Java.java 1 Aug 2003 06:44:36 -0000 1.68
+++ Java.java 1 Aug 2003 10:08:12 -0000 1.69
@@ -109,7 +109,7 @@
int err = -1;
try {
err = executeJava();
- if (fork && Execute.isFailure(err)) {
+ if (fork && err != 0) {
if (failOnError) {
throw new BuildException("Java returned: " + err, getLocation());
} else {
1.122 +1 -1 ant/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
Index: Javadoc.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Javadoc.java,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -r1.121 -r1.122
--- Javadoc.java 25 Jul 2003 12:14:42 -0000 1.121
+++ Javadoc.java 1 Aug 2003 10:08:12 -0000 1.122
@@ -1984,7 +1984,7 @@
try {
exe.setCommandline(toExecute.getCommandline());
int ret = exe.execute();
- if (Execute.isFailure(ret) && failOnError) {
+ if (ret != 0 && failOnError) {
throw new BuildException("Javadoc returned " + ret, getLocation());
}
} catch (IOException e) {
1.34 +1 -1 ant/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java
Index: ANTLR.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- ANTLR.java 25 Jul 2003 12:14:42 -0000 1.33
+++ ANTLR.java 1 Aug 2003 10:08:12 -0000 1.34
@@ -318,7 +318,7 @@
log(commandline.describeCommand(), Project.MSG_VERBOSE);
int err = run(commandline.getCommandline());
- if (Execute.isFailure(err)) {
+ if (err != 0) {
throw new BuildException("ANTLR returned: " + err, getLocation());
} else {
String output = bos.toString();
1.15 +1 -1 ant/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java
Index: CCMCheck.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- CCMCheck.java 25 Jul 2003 12:14:42 -0000 1.14
+++ CCMCheck.java 1 Aug 2003 10:08:12 -0000 1.15
@@ -198,7 +198,7 @@
checkOptions(commandLine);
int result = run(commandLine);
- if (Execute.isFailure(0)) {
+ if (Execute.isFailure(result)) {
String msg = "Failed executing: " + commandLine.toString();
throw new BuildException(msg, getLocation());
}
1.3 +1 -1 ant/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJDoc.java
Index: JJDoc.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJDoc.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- JJDoc.java 25 Jul 2003 12:14:43 -0000 1.2
+++ JJDoc.java 1 Aug 2003 10:08:12 -0000 1.3
@@ -194,7 +194,7 @@
process.setCommandline(cmdl.getCommandline());
try {
- if (Execute.isFailure(process.execute())) {
+ if (process.execute() != 0) {
throw new BuildException("JJDoc failed.");
}
} catch (IOException e) {
1.25 +1 -1 ant/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java
Index: JJTree.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- JJTree.java 25 Jul 2003 12:14:43 -0000 1.24
+++ JJTree.java 1 Aug 2003 10:08:12 -0000 1.25
@@ -290,7 +290,7 @@
process.setCommandline(cmdl.getCommandline());
try {
- if (Execute.isFailure(process.execute())) {
+ if (process.execute() != 0) {
throw new BuildException("JJTree failed.");
}
} catch (IOException e) {
1.16 +1 -1 ant/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java
Index: AbstractMetamataTask.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- AbstractMetamataTask.java 25 Jul 2003 12:14:43 -0000 1.15
+++ AbstractMetamataTask.java 1 Aug 2003 10:08:12 -0000 1.16
@@ -246,7 +246,7 @@
log(cmdl.describeCommand(), Project.MSG_VERBOSE);
process.setCommandline(cmdl.getCommandline());
try {
- if (Execute.isFailure(process.execute())) {
+ if (process.execute() != 0) {
throw new BuildException("Metamata task failed.");
}
} catch (IOException e) {
1.21 +1 -1 ant/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java
Index: MParse.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- MParse.java 25 Jul 2003 12:14:43 -0000 1.20
+++ MParse.java 1 Aug 2003 10:08:12 -0000 1.21
@@ -183,7 +183,7 @@
log(cmdl.describeCommand(), Project.MSG_VERBOSE);
process.setCommandline(cmdl.getCommandline());
try {
- if (Execute.isFailure(process.execute())) {
+ if (process.execute() != 0) {
throw new BuildException("Metamata task failed.");
}
} catch (IOException e) {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org