From cba01025c08dc79ce71c75c884e3837219a070aa Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Thu, 7 May 2009 08:19:29 +0000 Subject: [PATCH] honor failonerror on connection problems. PR 46829. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@772543 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 4 ++++ .../tools/ant/taskdefs/optional/ssh/SSHExec.java | 13 +++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) 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());