ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/condition Socket.java
Date Wed, 10 Sep 2003 18:20:46 GMT
antoine     2003/09/10 11:20:46

  Modified:    .        WHATSNEW
               src/main/org/apache/tools/ant/taskdefs/condition Socket.java
  Log:
  close the socket created by the socket condition
  I have tested the issue. With the new code, within approximatively 100 milliseconds,
  the socket is gone while ant keeps running.
  PR: 23040
  Submitted by: John C. Kendall (jkendall at technologist dot com)
  
  Revision  Changes    Path
  1.497     +3 -0      ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.496
  retrieving revision 1.497
  diff -u -r1.496 -r1.497
  --- WHATSNEW	3 Sep 2003 15:22:10 -0000	1.496
  +++ WHATSNEW	10 Sep 2003 18:20:45 -0000	1.497
  @@ -236,6 +236,9 @@
   * Project.toBoolean(String) now handles null as argument and does not throw a
     NullPointerException any more.
   
  +* The socket condition will now close the socket created to test.
  +  Bugzilla Report 23040.
  +
   Other changes:
   --------------
   * All tasks can be used outside of <target>s.  Note that some tasks
  
  
  
  1.8       +12 -1     ant/src/main/org/apache/tools/ant/taskdefs/condition/Socket.java
  
  Index: Socket.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/condition/Socket.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Socket.java	25 Jul 2003 08:28:21 -0000	1.7
  +++ Socket.java	10 Sep 2003 18:20:46 -0000	1.8
  @@ -103,10 +103,21 @@
           }
           log("Checking for listener at " + server + ":" + port,
               Project.MSG_VERBOSE);
  +        java.net.Socket s = null;
           try {
  -            new java.net.Socket(server, port);
  +            s = new java.net.Socket(server, port);
           } catch (IOException e) {
               return false;
  +        }
  +        finally {
  +          if (s != null){
  +            try {
  +              s.close();
  +            }
  +            catch (IOException ioe){
  +              // Intentionally left blank
  +            }
  +          }
           }
           return true;
       }
  
  
  

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


Mime
View raw message