2012/12/5  <ma...@apache.org>:
> Author: markt
> Date: Tue Dec  4 21:38:54 2012
> New Revision: 1417201
>
> URL: http://svn.apache.org/viewvc?rev=1417201&view=rev
> Log:
> Fix FindBugs warning
> Avoid NPE (although given an OOME has occurred I'm not sure it matters)

I think it is worth backporting.

If NPE happens, log.error("", oom);  will be skipped. It is better to
always log OOMs, as things might start going weird after them.

Maybe move log.error(); statement higher by several lines.

> Modified:
>     tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
>
> Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
> URL: 
> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1417201&r1=1417200&r2=1417201&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
> +++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Tue Dec  4 
> 21:38:54 2012
> @@ -1617,7 +1617,9 @@ public class NioEndpoint extends Abstrac
>                  } catch (OutOfMemoryError oom) {
>                      try {
>                          oomParachuteData = null;
> -                        
> socket.getPoller().cancelledKey(key,SocketStatus.ERROR);
> +                        if (socket != null) {
> +                            
> socket.getPoller().cancelledKey(key,SocketStatus.ERROR);
> +                        }
>                          releaseCaches();
>                          log.error("", oom);
>                      }catch ( Throwable oomt ) {
>

Best regards,
Konstantin Kolinko

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

Reply via email to