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 Tue, 05 Oct 2004 22:16:20 GMT
remm        2004/10/05 15:16:20

  Modified:    util/java/org/apache/tomcat/util/net/res
                        LocalStrings.properties
               util/java/org/apache/tomcat/util/net PoolTcpEndpoint.java
  Log:
  - Improve i18n (help is needed to do this kind of work everywhere :) ).
  - Improve error message when a SocketException occurs in setSocketOptions.
  
  Revision  Changes    Path
  1.5       +6 -0      jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/res/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/res/LocalStrings.properties,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- LocalStrings.properties	11 Oct 2003 14:37:00 -0000	1.4
  +++ LocalStrings.properties	5 Oct 2004 22:16:20 -0000	1.5
  @@ -4,3 +4,9 @@
   endpoint.warn.reinit=Reinitializing ServerSocket
   endpoint.warn.restart=Restarting endpoint
   endpoint.warn.security=Endpoint {0} security exception: {1}
  +endpoint.err.socket=Socket error caused by remote host {0}
  +endpoint.err.handshake=Handshake failed
  +endpoint.err.unexpected=Unexpected error processing socket
  +endpoint.warn.nullSocket=Null socket returned by accept
  +endpoint.debug.unlock=Caught exception trying to unlock accept on port {0}
  +endpoint.err.close=Caught exception trying to close socket
  \ No newline at end of file
  
  
  
  1.41      +15 -15    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.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- PoolTcpEndpoint.java	3 Oct 2004 11:48:59 -0000	1.40
  +++ PoolTcpEndpoint.java	5 Oct 2004 22:16:20 -0000	1.41
  @@ -359,7 +359,7 @@
               if( serverSocket!=null)
                   serverSocket.close();
           } catch(Exception e) {
  -            log.error("Caught exception trying to close socket.", e);
  +            log.error(sm.getString("endpoint.err.close"), e);
           }
           serverSocket = null;
       }
  @@ -369,16 +369,17 @@
           try {
               // Need to create a connection to unlock the accept();
               if (inet == null) {
  -                s=new Socket("127.0.0.1", port );
  -            }else{
  -                s=new Socket(inet, port );
  +                s = new Socket("127.0.0.1", port);
  +            } else {
  +                s = new Socket(inet, port);
                       // setting soLinger to a small value will help shutdown the
                       // connection quicker
                   s.setSoLinger(true, 0);
               }
           } catch(Exception e) {
  -            log.debug("Caught exception trying to unlock accept on " + port
  -                      + " " + e.toString());
  +            if (log.isDebugEnabled()) {
  +                log.debug(sm.getString("endpoint.debug.unlock", "" + port), e);
  +            }
           } finally {
               if (s != null) {
                   try {
  @@ -404,7 +405,7 @@
                   accepted = factory.acceptSocket(serverSocket);
               }
               if (null == accepted) {
  -                log.warn("Null socket returned by accept");
  +                log.warn(sm.getString("endpoint.warn.nullSocket"));
               } else {
                   if (!running) {
                       accepted.close();  // rude, but unlikely!
  @@ -425,7 +426,7 @@
               // socket with SocketPermission's.
               // Log the unauthorized access and continue
               String msg = sm.getString("endpoint.warn.security",
  -                                      serverSocket,ace);
  +                                      serverSocket, ace);
               log.warn(msg);
           }
           catch (IOException e) {
  @@ -524,11 +525,8 @@
               getConnectionHandler().processConnection(con, threadData);
               
           } catch (SocketException se) {
  -            PoolTcpEndpoint.log.error(
  -                    "Remote Host "
  -                    + s.getInetAddress()
  -                    + " SocketException: "
  -                    + se.getMessage());
  +            log.error(sm.getString("endpoint.err.socket", s.getInetAddress()),
  +                    se);
               // Try to close the socket
               try {
                   s.close();
  @@ -536,9 +534,11 @@
               }
           } catch (Throwable t) {
               if (step == 2) {
  -                PoolTcpEndpoint.log.debug("Handshake failed", t);
  +                if (log.isDebugEnabled()) {
  +                    log.debug(sm.getString("endpoint.err.handshake"), t);
  +                }
               } else {
  -                PoolTcpEndpoint.log.error("Unexpected error", t);
  +                log.error(sm.getString("endpoint.err.unexpected"), t);
               }
               // Try to close the socket
               try {
  
  
  

---------------------------------------------------------------------
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