diff --git a/WHATSNEW b/WHATSNEW index ee3c9d955..e8f4ba6dd 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -367,6 +367,10 @@ Fixed bugs: that are already signed. Bugzilla Report 46891. + * now again honors failonerror in the face of connection + errors. + Bugzilla Report 46829. + Other changes: -------------- * A HostInfo task was added performing information on hosts, including info on diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java index cb6174d31..481ffe5f1 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java @@ -206,11 +206,20 @@ public class SSHExec extends SSHBase { } FileUtils.close(br); } catch (IOException e) { - throw new BuildException(e); + if (getFailonerror()) { + throw new BuildException(e); + } else { + log("Caught exception: " + e.getMessage(), + Project.MSG_ERR); + } } } } catch (JSchException e) { - throw new BuildException(e); + if (getFailonerror()) { + throw new BuildException(e); + } else { + log("Caught exception: " + e.getMessage(), Project.MSG_ERR); + } } finally { if (outputProperty != null) { getProject().setNewProperty(outputProperty, output.toString());