diff --git a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/TargetLock.java b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/TargetLock.java
index 66ac58d..ef88abf 100644
--- a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/TargetLock.java
+++ b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/TargetLock.java
@@ -147,6 +147,9 @@
     private static final String QP_SERVER = "server";
     private static final String QP_TTL = "ttl";
 
+    // define a constant for empty of byte array
+    private static final byte[] EMPTY_BYTE_ARRAY = {};
+
     /**
      * This method triggers registration of 'eventHandler', and also extracts
      * property values.
@@ -1524,7 +1527,7 @@
 
                 logger.error("Couldn't forward 'lock/dumpLocksData to uuid {}",
                              serverUuid);
-                return null;
+                return EMPTY_BYTE_ARRAY;
             }
 
             return Base64.getEncoder().encode(Util.serialize(new HostData()));
@@ -1641,11 +1644,7 @@
                 UUID uuid = cdr.identity.uuid;
 
                 // fetch/generate 'MergeData' instance for this UUID
-                MergedData md = mergedDataMap.get(uuid);
-                if (md == null) {
-                    md = new MergedData(uuid);
-                    mergedDataMap.put(uuid, md);
-                }
+                MergedData md = mergedDataMap.computeIfAbsent(uuid, key -> new MergedData(uuid));
 
                 // update 'MergedData.clientDataRecord'
                 if (md.clientDataRecord == null) {
@@ -1680,11 +1679,7 @@
                 UUID uuid = le.currentOwnerUuid;
 
                 // fetch/generate 'MergeData' instance for this UUID
-                MergedData md = mergedDataMap.get(uuid);
-                if (md == null) {
-                    md = new MergedData(uuid);
-                    mergedDataMap.put(uuid, md);
-                }
+                MergedData md = mergedDataMap.computeIfAbsent(uuid, key -> new MergedData(uuid));
 
                 // update 'lockEntries' table entry
                 if (lockEntries.get(le.key) != null) {
@@ -1728,11 +1723,7 @@
             UUID uuid = waiting.ownerUuid;
 
             // fetch/generate 'MergeData' instance for this UUID
-            MergedData md = mergedDataMap.get(uuid);
-            if (md == null) {
-                md = new MergedData(uuid);
-                mergedDataMap.put(uuid, md);
-            }
+            MergedData md = mergedDataMap.computeIfAbsent(uuid, key -> new MergedData(uuid));
 
             // update 'MergedData.serverLockEntry' and
             // 'MergedData.serverWaiting'
@@ -2383,7 +2374,7 @@
                 return Base64.getEncoder().encode(Util.serialize(this));
             } catch (IOException e) {
                 logger.error("TargetLock.AuditData.encode Exception", e);
-                return null;
+                return EMPTY_BYTE_ARRAY;
             }
         }
 
@@ -2557,7 +2548,7 @@
                 // if we reach this point, we didn't forward for some reason
 
                 logger.error("Couldn't forward 'lock/audit to uuid {}", serverUuid);
-                return null;
+                return EMPTY_BYTE_ARRAY;
             }
 
             AuditData auditData = AuditData.decode(encodedData);
@@ -2565,7 +2556,7 @@
                 AuditData auditResp = auditData.generateResponse(true);
                 return auditResp.encode();
             }
-            return null;
+            return EMPTY_BYTE_ARRAY;
         }
 
         /**
@@ -2650,9 +2641,7 @@
             // map 'key -> bucket number', and then 'bucket number' -> 'server'
             Server server = Bucket.bucketToServer(Bucket.bucketNumber(key));
             if (server != null) {
-                AuditData auditData =
-                    auditMap.computeIfAbsent(server, sk -> new AuditData());
-                return auditData;
+                return auditMap.computeIfAbsent(server, sk -> new AuditData());
             }
 
             // this happens when the bucket has not been assigned to a server yet
@@ -2712,7 +2701,7 @@
 
             // serialize
             byte[] encodedData = auditData.encode();
-            if (encodedData == null) {
+            if (encodedData.length == 0) {
                 // error has already been displayed
                 return;
             }
@@ -2779,7 +2768,7 @@
 
             // serialize
             byte[] encodedData = auditData.encode();
-            if (encodedData == null) {
+            if (encodedData.length == 0) {
                 // error has already been displayed
                 return;
             }
