This is an automated email from the ASF dual-hosted git repository.

tv pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jcs.git


The following commit(s) were added to refs/heads/master by this push:
     new d2b308bf Removed double null check with instance operator
     new 625f74f6 Merge pull request #135 from tbw777/instanceof
d2b308bf is described below

commit d2b308bfe3e8770463015303f8b709d1edded0b8
Author: Andrey Bruykhov <andreybr...@gmail.com>
AuthorDate: Wed Feb 1 11:16:31 2023 +0300

    Removed double null check with instance operator
    
    Sometimes found usage of instance operator with variable superflous check 
for null. But also there is not only variables.
---
 .../commons/jcs/auxiliary/lateral/javagroups/LateralJGReceiver.java     | 2 +-
 .../main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCache.java | 2 +-
 .../main/java/org/apache/commons/jcs/yajcache/core/CacheManager.java    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/auxiliary-builds/jdk14/src/java/org/apache/commons/jcs/auxiliary/lateral/javagroups/LateralJGReceiver.java
 
b/auxiliary-builds/jdk14/src/java/org/apache/commons/jcs/auxiliary/lateral/javagroups/LateralJGReceiver.java
index ee8687c0..e7692c42 100644
--- 
a/auxiliary-builds/jdk14/src/java/org/apache/commons/jcs/auxiliary/lateral/javagroups/LateralJGReceiver.java
+++ 
b/auxiliary-builds/jdk14/src/java/org/apache/commons/jcs/auxiliary/lateral/javagroups/LateralJGReceiver.java
@@ -89,7 +89,7 @@ public class LateralJGReceiver
                 try
                 {
                     Object obj = javagroups.receive( 0 );
-                    if ( obj != null && obj instanceof org.jgroups.Message )
+                    if ( obj instanceof org.jgroups.Message )
                     {
                         mes = (Message) obj;
                         if ( log.isDebugEnabled() )
diff --git 
a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCache.java
 
b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCache.java
index 9a400336..2d2ccfe7 100644
--- 
a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCache.java
+++ 
b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCache.java
@@ -141,7 +141,7 @@ public class RemoteCache<K, V>
         log.error( message, ex );
 
         // we should not switch if the existing is a zombie.
-        if ( getRemoteCacheService() == null || !( getRemoteCacheService() 
instanceof ZombieCacheServiceNonLocal ) )
+        if ( !( getRemoteCacheService() instanceof ZombieCacheServiceNonLocal 
) )
         {
             // TODO make configurable
             setRemoteCacheService( new ZombieCacheServiceNonLocal<>( 
getRemoteCacheAttributes().getZombieQueueMaxSize() ) );
diff --git 
a/commons-jcs-sandbox/yajcache/src/main/java/org/apache/commons/jcs/yajcache/core/CacheManager.java
 
b/commons-jcs-sandbox/yajcache/src/main/java/org/apache/commons/jcs/yajcache/core/CacheManager.java
index 56f34069..bede5517 100644
--- 
a/commons-jcs-sandbox/yajcache/src/main/java/org/apache/commons/jcs/yajcache/core/CacheManager.java
+++ 
b/commons-jcs-sandbox/yajcache/src/main/java/org/apache/commons/jcs/yajcache/core/CacheManager.java
@@ -73,7 +73,7 @@ public enum CacheManager {
     public ICacheSafe getSafeCache(@NonNullable String name) {
         ICache c = this.getCache(name);
 
-        if (c == null || !(c instanceof ICacheSafe))
+        if (!(c instanceof ICacheSafe))
             return null;
         return (ICacheSafe)c;
     }

Reply via email to