ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 23040] New: - Socket condition on Waitfor task does not close socket
Date Tue, 09 Sep 2003 20:26:09 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23040>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23040

Socket condition on Waitfor task does not close socket

           Summary: Socket condition on Waitfor task does not close socket
           Product: Ant
           Version: 1.6Alpha (nightly)
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: jkendall@technologist.com


The Socket.java class never closes the java.net.Socket.  This causes the socket 
connection to remain open until the build is finished.  This can cause problems 
on connection-limited resources.  Please make the following change: 
 
cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic commit 
./src/main/org/apache/tools/ant/taskdefs/condition/Socket.java 
 
Index: ./src/main/org/apache/tools/ant/taskdefs/condition/Socket.java 
=================================================================== 
RCS file: 
/home/cvspublic/ant/src/main/org/apache/tools/ant/taskdefs/condition/Socket.java,v 
retrieving revision 1.7 
diff -u -r1.7 Socket.java 
--- ./src/main/org/apache/tools/ant/taskdefs/condition/Socket.java      25 Jul 
2003 08:28:21 -0000      1.7 
+++ ./src/main/org/apache/tools/ant/taskdefs/condition/Socket.java      9 Sep 
2003 18:20:24 -0000 
@@ -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