On 22 July 2012 20:55,  <ma...@apache.org> wrote:
> Author: markt
> Date: Sun Jul 22 19:55:50 2012
> New Revision: 1364419
>
> URL: http://svn.apache.org/viewvc?rev=1364419&view=rev
> Log:
> Fingbugs: Fix possible NPE
>
> Modified:
>     
> tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java
>
> Modified: 
> tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java
> URL: 
> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java?rev=1364419&r1=1364418&r2=1364419&view=diff
> ==============================================================================
> --- 
> tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java
>  (original)
> +++ 
> tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java
>  Sun Jul 22 19:55:50 2012
> @@ -122,13 +122,14 @@ public class TcpPingInterceptor extends
>      }
>
>      protected void sendPing() {
> -        if (failureDetector.get()!=null) {
> -            //we have a reference to the failure detector
> -            //piggy back on that dude
> +        if (failureDetector.get() != null) {
> +            // We have a reference to the failure detector
> +            // Piggy back on it
>              failureDetector.get().checkMembers(true);

If it's necessary to pre-fetch staticMembers just once (as below) is
it not also necessary to pre-fetch failureDetector (above) ?

They are both WeakReference fields, so surely both can return null at any time?

> -        }else {
> -            if (staticOnly && staticMembers.get()!=null) {
> -                sendPingMessage(staticMembers.get().getMembers());
> +        } else {
> +            StaticMembershipInterceptor smi = staticMembers.get();
> +            if (staticOnly && smi != null) {
> +                sendPingMessage(smi.getMembers());
>              } else {
>                  sendPingMessage(getMembers());
>              }
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>

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

Reply via email to