From 9d63d7ee24e7848d344146831d4da3272e596d69 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Sat, 12 Jan 2019 17:13:51 +0100 Subject: [PATCH] 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 +++++++++++ .../taskdefs/optional/clearcase/CCCheckout.java | 2 +- .../ant/taskdefs/optional/clearcase/ClearCase.java | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/WHATSNEW b/WHATSNEW index 4d18c50b0..cadeec016 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 e60bfc966..4489b7bd0 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 68d2a4a00..6eecc8a6b 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);