bodewig     2005/02/18 03:00:58

  Modified:    .        WHATSNEW
               src/main/org/apache/tools/ant/taskdefs/optional/net
                        RExecTask.java TelnetTask.java
  Log:
  Don't close SocketClients if connect has failed, PR 33618
  
  Revision  Changes    Path
  1.748     +4 -0      ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.747
  retrieving revision 1.748
  diff -u -r1.747 -r1.748
  --- WHATSNEW  14 Feb 2005 14:39:37 -0000      1.747
  +++ WHATSNEW  18 Feb 2005 11:00:57 -0000      1.748
  @@ -318,6 +318,10 @@
     <exec>, <apply>, or <java> tasks was always logged to System.out
     instead of to the managing Task.
   
  +* <telnet> and <rexec> would try to disconnect from servers they never
  +  connetced to, potentially leading to exceptions in commons-net.
  +  Bugzilla Report 33618.
  +
   Changes from Ant 1.6.1 to Ant 1.6.2
   ===================================
   
  
  
  
  1.10      +10 -10    
ant/src/main/org/apache/tools/ant/taskdefs/optional/net/RExecTask.java
  
  Index: RExecTask.java
  ===================================================================
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/RExecTask.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- RExecTask.java    22 Nov 2004 09:23:34 -0000      1.9
  +++ RExecTask.java    18 Feb 2005 11:00:58 -0000      1.10
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2003-2004 The Apache Software Foundation
  + * Copyright  2003-2005 The Apache Software Foundation
    *
    *  Licensed under the Apache License, Version 2.0 (the "License");
    *  you may not use this file except in compliance with the License.
  @@ -342,15 +342,15 @@
               /** Keep reading input stream until end of it or time-out */
               rexec.waitForEOF(defaultTimeout);
          } finally {
  -           if (rexec != null) {
  -               try {
  -                   rexec.disconnect();
  -               } catch (IOException e) {
  -                   throw new BuildException("Error disconnecting from "
  -                                            + server);
  -               }
  -           }
  -       }
  +            if (rexec != null && rexec.isConnected()) {
  +                try {
  +                    rexec.disconnect();
  +                } catch (IOException e) {
  +                    throw new BuildException("Error disconnecting from "
  +                                             + server);
  +                }
  +            }
  +        }
       }
       /**
        *  Process a 'typical' login.  If it differs, use the read
  
  
  
  1.30      +3 -3      
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.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- TelnetTask.java   22 Nov 2004 09:23:34 -0000      1.29
  +++ TelnetTask.java   18 Feb 2005 11:00:58 -0000      1.30
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2000,2002-2004 The Apache Software Foundation
  + * Copyright  2000,2002-2005 The Apache Software Foundation
    *
    *  Licensed under the Apache License, Version 2.0 (the "License");
    *  you may not use this file except in compliance with the License.
  @@ -114,7 +114,7 @@
                  task.execute(telnet);
              }
          } finally {
  -           if (telnet != null) {
  +           if (telnet != null && telnet.isConnected()) {
                  try {
                      telnet.disconnect();
                  } catch (IOException e) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to