tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net PoolTcpEndpoint.java
Date Sat, 26 Jul 2003 15:04:35 GMT
remm        2003/07/26 08:04:35

  Modified:    util/java/org/apache/tomcat/util/net PoolTcpEndpoint.java
  Log:
  - Close socket inside a finally block.
  
  Revision  Changes    Path
  1.15      +12 -5     jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java
  
  Index: PoolTcpEndpoint.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- PoolTcpEndpoint.java	27 Mar 2003 04:08:20 -0000	1.14
  +++ PoolTcpEndpoint.java	26 Jul 2003 15:04:35 -0000	1.15
  @@ -319,9 +319,9 @@
       }
   
       protected void closeServerSocket() {
  +        Socket s = null;
           try {
               // Need to create a connection to unlock the accept();
  -            Socket s;
               if (inet == null) {
                   s=new Socket("127.0.0.1", port );
               }else{
  @@ -330,10 +330,17 @@
                       // connection quicker
                   s.setSoLinger(true, 0);
               }
  -            s.close();
           } catch(Exception e) {
               log.error("Caught exception trying to unlock accept on " + port
                       + " " + e.toString());
  +        } finally {
  +            if (s != null) {
  +                try {
  +                    s.close();
  +                } catch (Exception e) {
  +                    // Ignore
  +                }
  +            }
           }
           try {
               if( serverSocket!=null)
  
  
  

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


Mime
View raw message