on 1/31/02 12:56 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:

> craigmcc    02/01/31 12:56:03
> 
> Modified:    catalina/src/share/org/apache/catalina/connector/http
>                       HttpConnector.java
>              catalina/src/share/org/apache/catalina/core
>                       StandardServer.java
> Log:
> Enhance the exception message produced when creating a server socket
> fails (typically due to an "Address in use" situation) to include the
> port number of the failed open.
> 
> Enhancements to the proposed patch include:
> * If the socket is only for a particular IP address, report that also.
> * Add a similar enhancement to the message for the shutdown port opening
>   (although you will normally encounter an error on the connector before
>   running in to this one).
> 
> PR: Bugzilla #6130
> Submitted by:    Jon Stevens <[EMAIL PROTECTED]>
> 
> Revision  Changes    Path
> 1.30      +16 -6 
> jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpC
> onnector.java
> 
> Index: HttpConnector.java
> ===================================================================
> RCS file: 
> /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/
> http/HttpConnector.java,v
> retrieving revision 1.29
> retrieving revision 1.30
> diff -u -r1.29 -r1.30
> --- HttpConnector.java    20 Dec 2001 21:25:23 -0000    1.29
> +++ HttpConnector.java    31 Jan 2002 20:56:03 -0000    1.30
> @@ -1,7 +1,7 @@
>  /*
> - * $Header: 
> /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/
> http/HttpConnector.java,v 1.29 2001/12/20 21:25:23 remm Exp $
> - * $Revision: 1.29 $
> - * $Date: 2001/12/20 21:25:23 $
> + * $Header: 
> /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/
> http/HttpConnector.java,v 1.30 2002/01/31 20:56:03 craigmcc Exp $
> + * $Revision: 1.30 $
> + * $Date: 2002/01/31 20:56:03 $
>   *
>   * ====================================================================
>   *
> @@ -66,6 +66,7 @@
>  
>  
>  import java.io.IOException;
> +import java.net.BindException;
>  import java.net.InetAddress;
>  import java.net.ServerSocket;
>  import java.net.Socket;
> @@ -102,7 +103,7 @@
>   *
>   * @author Craig R. McClanahan
>   * @author Remy Maucherat
> - * @version $Revision: 1.29 $ $Date: 2001/12/20 21:25:23 $
> + * @version $Revision: 1.30 $ $Date: 2002/01/31 20:56:03 $
>   */
>  
>  
> @@ -972,14 +973,23 @@
>          // If no address is specified, open a connection on all addresses
>          if (address == null) {
>              log(sm.getString("httpConnector.allAddresses"));
> -            return (factory.createSocket(port, acceptCount));
> +            try {
> +                return (factory.createSocket(port, acceptCount));
> +            } catch (BindException be) {
> +                throw new BindException(be.getMessage() + ":" + port);
> +            }
>          }
>  
>          // Open a server socket on the specified address
>          try {
>              InetAddress is = InetAddress.getByName(address);
>              log(sm.getString("httpConnector.anAddress", address));
> -            return (factory.createSocket(port, acceptCount, is));
> +            try {
> +                return (factory.createSocket(port, acceptCount, is));
> +            } catch (BindException be) {
> +                throw new BindException(be.getMessage() + ":" + address +
> +                                        ":" + port);
> +            }
>          } catch (Exception e) {
>              log(sm.getString("httpConnector.noAddress", address));
>              return (factory.createSocket(port, acceptCount));

Hey Craig, there is another factory.createSocket that gets created in the
catch clause right above...seems that that should be in a
try/catch(BindException) as well, doesn't it?

That is why I originally wrapped so much of the code in a single
try/catch...

-jon


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

Reply via email to