Browse Source

Small refactoring to prepare for bug 25935

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276609 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 21 years ago
parent
commit
5004c56586
1 changed files with 3 additions and 8 deletions
  1. +3
    -8
      src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java

+ 3
- 8
src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java View File

@@ -55,11 +55,6 @@ public class TelnetTask extends Task {
*/ */
private int port = 23; private int port = 23;


/**
* The Object which handles the telnet session.
*/
private AntTelnetClient telnet = null;

/** /**
* The list of read/write commands for this session * The list of read/write commands for this session
*/ */
@@ -97,7 +92,7 @@ public class TelnetTask extends Task {
} }


/** Create the telnet client object */ /** Create the telnet client object */
telnet = new AntTelnetClient();
AntTelnetClient telnet = new AntTelnetClient();
try { try {
telnet.connect(server, port); telnet.connect(server, port);
} catch (IOException e) { } catch (IOException e) {
@@ -105,7 +100,7 @@ public class TelnetTask extends Task {
} }
/** Login if userid and password were specified */ /** Login if userid and password were specified */
if (userid != null && password != null) { if (userid != null && password != null) {
login();
login(telnet);
} }
/** Process each sub command */ /** Process each sub command */
Enumeration tasksToRun = telnetTasks.elements(); Enumeration tasksToRun = telnetTasks.elements();
@@ -122,7 +117,7 @@ public class TelnetTask extends Task {
* Process a 'typical' login. If it differs, use the read * Process a 'typical' login. If it differs, use the read
* and write tasks explicitely * and write tasks explicitely
*/ */
private void login() {
private void login(AntTelnetClient telnet) {
if (addCarriageReturn) { if (addCarriageReturn) {
telnet.sendString("\n", true); telnet.sendString("\n", true);
} }


Loading…
Cancel
Save