On Thu, 31 Jan 2002, Jon Scott Stevens wrote:
> >
> >
> > @@ -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);
> > + }
> > }
> >
This is "the one above" (when address == null)
> > // 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);
> > + }
and this is "the one below"
> > } catch (Exception e) {
> > log(sm.getString("httpConnector.noAddress", address));
> > return (factory.createSocket(port, acceptCount));
>
but this is "the one I forgot". Fixed in a sec.
> 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...
I've been burnt a few times by long try/catch blocks, wondering exactly
which statement threw the exception, so it's just a habit to make the
scope as narrow as possible.
>
> -jon
>
Craig
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>