You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2019/01/12 16:16:10 UTC

[ant] 02/02: respect failOnError when running ls checkout - Bugzilla 63071

This is an automated email from the ASF dual-hosted git repository.

bodewig pushed a commit to branch 1.9.x
in repository https://gitbox.apache.org/repos/asf/ant.git

commit 9d63d7ee24e7848d344146831d4da3272e596d69
Author: Stefan Bodewig <bo...@apache.org>
AuthorDate: Sat Jan 12 17:13:51 2019 +0100

    respect failOnError when running ls checkout - Bugzilla 63071
    
    I've decided to break backwards compatibility with the way I've
    overridden runS. The "proper" way would have been to call the one-arg
    version from the two-arg version so that subclasses overriding runS
    would still get their method called. But I figured it to be extremely
    unlikely that such subclasses exist.
---
 WHATSNEW                                                   | 11 +++++++++++
 .../tools/ant/taskdefs/optional/clearcase/CCCheckout.java  |  2 +-
 .../tools/ant/taskdefs/optional/clearcase/ClearCase.java   | 14 ++++++++++++++
 3 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/WHATSNEW b/WHATSNEW
index 4d18c50..cadeec0 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -1,6 +1,13 @@
 Changes from Ant 1.9.13 TO Ant 1.9.14
 =====================================
 
+Changes that could break older environments:
+-------------------------------------------
+
+ * ClearCase#runS has been augmented by a two arg-version and the
+   one-arg version will no longer be called. This may affect
+   subclasses that have overridden runS.
+
 Fixed bugs:
 -----------
 
@@ -16,6 +23,10 @@ Fixed bugs:
    an incorrect compression level for a zip entry. This is now fixed.
    Bugzilla Report 62686
 
+ * cccheckout would ignore an error of the "ls checkout" command even
+   if failOnError was set to false.
+   Bugzilla Report 63071
+
 Other changes:
 --------------
  * generatekey task now supports SubjectAlternativeName during key
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckout.java b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckout.java
index e60bfc9..4489b7b 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckout.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckout.java
@@ -168,7 +168,7 @@ public class CCCheckout extends ClearCase {
         // viewpath
         cmdl.createArgument().setValue(getViewPath());
 
-        result = runS(cmdl);
+        result = runS(cmdl, getFailOnErr());
 
         // System.out.println( "lsCheckout: " + result );
 
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java
index 68d2a4a..6eecc8a 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java
@@ -144,8 +144,21 @@ public abstract class ClearCase extends Task {
      * Execute the given command, and return it's output
      * @param cmdline command line to execute
      * @return output of the command line
+     * @deprecated use the two arg version instead
      */
+    @Deprecated
     protected String runS(Commandline cmdline) {
+        return runS(cmdline, false);
+    }
+
+    /**
+     * Execute the given command, and return it's output
+     * @param cmdline command line to execute
+     * @param failOnError whether to fail the build if the command fails
+     * @return output of the command line
+     * @since Ant 1.9.14
+     */
+    protected String runS(Commandline cmdline, boolean failOnError) {
         String   outV  = "opts.cc.runS.output" + pcnt++;
         ExecTask exe   = new ExecTask(this);
         Commandline.Argument arg = exe.createArg();
@@ -153,6 +166,7 @@ public abstract class ClearCase extends Task {
         exe.setExecutable(cmdline.getExecutable());
         arg.setLine(Commandline.toString(cmdline.getArguments()));
         exe.setOutputproperty(outV);
+        exe.setFailonerror(failOnError);
         exe.execute();
 
         return getProject().getProperty(outV);