You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by sh...@apache.org on 2017/07/22 14:02:25 UTC

kylin git commit: KYLIN-2612 fix potential NPE accessing familyMap

Repository: kylin
Updated Branches:
  refs/heads/2.1.x 0e139d8b5 -> 838b047e1


KYLIN-2612 fix potential NPE accessing familyMap


Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/838b047e
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/838b047e
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/838b047e

Branch: refs/heads/2.1.x
Commit: 838b047e1201394eeda5e3fcf9dd16cad5e31854
Parents: 0e139d8
Author: shaofengshi <sh...@apache.org>
Authored: Sat Jul 22 22:02:13 2017 +0800
Committer: shaofengshi <sh...@apache.org>
Committed: Sat Jul 22 22:02:13 2017 +0800

----------------------------------------------------------------------
 .../kylin/rest/service/AclTableMigrationTool.java       | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/838b047e/server-base/src/main/java/org/apache/kylin/rest/service/AclTableMigrationTool.java
----------------------------------------------------------------------
diff --git a/server-base/src/main/java/org/apache/kylin/rest/service/AclTableMigrationTool.java b/server-base/src/main/java/org/apache/kylin/rest/service/AclTableMigrationTool.java
index bb07c22..e8b675e 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/service/AclTableMigrationTool.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/service/AclTableMigrationTool.java
@@ -223,11 +223,13 @@ public class AclTableMigrationTool {
     private Map<String, AceInfo> getAllAceInfo(Result result) throws IOException {
         Map<String, AceInfo> allAceInfoMap = new HashMap<>();
         NavigableMap<byte[], byte[]> familyMap = result.getFamilyMap(Bytes.toBytes(AclConstant.ACL_ACES_FAMILY));
-        for (Map.Entry<byte[], byte[]> entry : familyMap.entrySet()) {
-            String sid = new String(entry.getKey());
-            AceInfo aceInfo = aceSerializer.deserialize(entry.getValue());
-            if (null != aceInfo) {
-                allAceInfoMap.put(sid, aceInfo);
+        if(familyMap != null && !familyMap.isEmpty()) {
+            for (Map.Entry<byte[], byte[]> entry : familyMap.entrySet()) {
+                String sid = new String(entry.getKey());
+                AceInfo aceInfo = aceSerializer.deserialize(entry.getValue());
+                if (null != aceInfo) {
+                    allAceInfoMap.put(sid, aceInfo);
+                }
             }
         }
         return allAceInfoMap;