From befcdc72067b9a6018e163337b95e4877762be24 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Wed, 23 Jun 2004 12:25:05 +0000 Subject: [PATCH] Indentation of telnet tasks, record bug fix git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276611 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 2 ++ .../ant/taskdefs/optional/net/TelnetTask.java | 34 +++++++++---------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index 2394a4d32..2cd2c1de9 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -151,6 +151,8 @@ Fixed bugs: * now has (local|remote)tofile attributes to rename files on the fly. Bugzilla Report 26758. +* didn't close the session. Bugzilla Report 25935. + Other changes: -------------- * doc fix concerning the dependencies of the ftp task diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java index 10cc53618..4529cda00 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java @@ -95,24 +95,24 @@ public class TelnetTask extends Task { AntTelnetClient telnet = null; try { telnet = new AntTelnetClient(); - try { - telnet.connect(server, port); - } catch (IOException e) { - throw new BuildException("Can't connect to " + server); - } - /** Login if userid and password were specified */ - if (userid != null && password != null) { - login(telnet); - } - /** Process each sub command */ - Enumeration tasksToRun = telnetTasks.elements(); - while (tasksToRun != null && tasksToRun.hasMoreElements()) { - TelnetSubTask task = (TelnetSubTask) tasksToRun.nextElement(); - if (task instanceof TelnetRead && defaultTimeout != null) { - ((TelnetRead) task).setDefaultTimeout(defaultTimeout); + try { + telnet.connect(server, port); + } catch (IOException e) { + throw new BuildException("Can't connect to " + server); + } + /** Login if userid and password were specified */ + if (userid != null && password != null) { + login(telnet); + } + /** Process each sub command */ + Enumeration tasksToRun = telnetTasks.elements(); + while (tasksToRun != null && tasksToRun.hasMoreElements()) { + TelnetSubTask task = (TelnetSubTask) tasksToRun.nextElement(); + if (task instanceof TelnetRead && defaultTimeout != null) { + ((TelnetRead) task).setDefaultTimeout(defaultTimeout); + } + task.execute(telnet); } - task.execute(telnet); - } } finally { if (telnet != null) { try {