tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <knst.koli...@gmail.com>
Subject Re: svn commit: r1417201 - /tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
Date Tue, 04 Dec 2012 23:40:46 GMT
2012/12/5  <markt@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message