[infinispan-commits] Infinispan SVN: r771 - trunk/core/src/main/java/org/infinispan/interceptors.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Thu Sep 3 05:43:09 EDT 2009


Author: mircea.markus
Date: 2009-09-03 05:43:08 -0400 (Thu, 03 Sep 2009)
New Revision: 771

Modified:
   trunk/core/src/main/java/org/infinispan/interceptors/TxInterceptor.java
Log:
 findbugs: 
Potentially dangerous use of non-short-circuit logic
This code seems to be using non-short-circuit logic (e.g., & or |) rather than short-circuit logic (&& or ||). In addition, it seem possible that, depending on the value of the left hand side, you might not want to evaluate the right hand side (because it would have side effects, could cause an exception or could be expensive.
Non-short-circuit logic causes both sides of the expression to be evaluated even when the result can be inferred from knowing the left-hand side. This can be less efficient and can result in errors if the left-hand side guards cases when evaluating the right-hand side can generate an error.
See the Java Language Specification for details

Modified: trunk/core/src/main/java/org/infinispan/interceptors/TxInterceptor.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/interceptors/TxInterceptor.java	2009-09-03 09:41:32 UTC (rev 770)
+++ trunk/core/src/main/java/org/infinispan/interceptors/TxInterceptor.java	2009-09-03 09:43:08 UTC (rev 771)
@@ -197,7 +197,7 @@
    }
 
    private boolean shouldEnlist(InvocationContext ctx) {
-      return ctx.isInTxScope() & ctx.isOriginLocal();
+      return ctx.isInTxScope() && ctx.isOriginLocal();
    }
 
    private boolean isLocalModeForced(InvocationContext icx) {



More information about the infinispan-commits mailing list