Noel,

Shouldn't the exception be logged even if the socket is null ?


It is good to check for socket != null, but
            try {
                doQUIT(null);
            } catch(Throwable t) { }
Would be effective even if it is socket is null. It is a best effort attempt
to send QUIT, invoked only in exceptional circumstances.

Harmeet

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, January 26, 2003 10:35 PM
Subject: cvs commit: jakarta-james/src/java/org/apache/james/nntpserver
NNTPHandler.java


> noel        2003/01/26 19:35:40
>
>   Modified:    src/java/org/apache/james/nntpserver NNTPHandler.java
>   Log:
>   Fixed the regression caused by the previous change.  The socket will be
null (and closed) if the connection has idled out.
>
>   Revision  Changes    Path
>   1.32      +10 -6
jakarta-james/src/java/org/apache/james/nntpserver/NNTPHandler.java
>
>   Index: NNTPHandler.java
>   ===================================================================
>   RCS file:
/home/cvs/jakarta-james/src/java/org/apache/james/nntpserver/NNTPHandler.jav
a,v
>   retrieving revision 1.31
>   retrieving revision 1.32
>   diff -u -r1.31 -r1.32
>   --- NNTPHandler.java 18 Jan 2003 19:01:45 -0000 1.31
>   +++ NNTPHandler.java 27 Jan 2003 03:35:40 -0000 1.32
>   @@ -353,13 +353,17 @@
>
>                getLogger().info("Connection closed");
>            } catch (Exception e) {
>   -            // unexpected error. try to send quit msg.
>   -            // this may fail if socket has been closed by peer.
>   -            try {
>   -                doQUIT(null);
>   -            } catch(Throwable t) { }
>   +            // if the connection has been idled out, the
>   +            // socket will be closed and null.  Do NOT
>   +            // log the exception or attempt to send the
>   +            // closing connection message
>   +            if (socket != null) {
>   +                try {
>   +                    doQUIT(null);
>   +                } catch(Throwable t) { }
>
>   -            getLogger().error( "Exception during connection:" +
e.getMessage(), e );
>   +                getLogger().error( "Exception during connection:" +
e.getMessage(), e );
>   +            }
>            } finally {
>                resetHandler();
>            }
>
>
>
>
> --
> 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]>

Reply via email to