ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net TelnetTask.java
Date Wed, 23 Jun 2004 12:23:22 GMT
bodewig     2004/06/23 05:23:22

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/net
                        TelnetTask.java
  Log:
  properly disconnect from telnet server.
  
  PR: 25935
  Submitted by:	carcher at yahoo dot com
  
  Revision  Changes    Path
  1.27      +13 -1     ant/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java
  
  Index: TelnetTask.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- TelnetTask.java	23 Jun 2004 12:19:23 -0000	1.26
  +++ TelnetTask.java	23 Jun 2004 12:23:22 -0000	1.27
  @@ -92,7 +92,9 @@
          }
   
          /**  Create the telnet client object */
  -       AntTelnetClient telnet = new AntTelnetClient();
  +       AntTelnetClient telnet = null;
  +       try {
  +           telnet = new AntTelnetClient();
          try {
              telnet.connect(server, port);
          } catch (IOException e) {
  @@ -110,6 +112,16 @@
                  ((TelnetRead) task).setDefaultTimeout(defaultTimeout);
              }
              task.execute(telnet);
  +       }
  +       } finally {
  +           if (telnet != null) {
  +               try {
  +                   telnet.disconnect();
  +               } catch (IOException e) {
  +                   throw new BuildException("Error disconnecting from " 
  +                                            + server);
  +               }
  +           }
          }
       }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message