atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From suma...@apache.org
Subject incubator-atlas git commit: ATLAS-1053: Fix for issues flagged by Coverity scan - potential NPE
Date Tue, 26 Jul 2016 18:32:38 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/master 56e97e225 -> d0a9b9999


ATLAS-1053: Fix for issues flagged by Coverity scan - potential NPE


Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/d0a9b999
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/d0a9b999
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/d0a9b999

Branch: refs/heads/master
Commit: d0a9b99999a8d51a6612da62d025fbb48c471bc6
Parents: 56e97e2
Author: Madhan Neethiraj <madhan@apache.org>
Authored: Mon Jul 25 19:21:33 2016 -0700
Committer: Suma Shivaprasad <sumasai.shivaprasad@gmail.com>
Committed: Tue Jul 26 11:32:24 2016 -0700

----------------------------------------------------------------------
 .../atlas/hive/bridge/HiveMetaStoreBridge.java  | 22 +++++++++++++-------
 .../org/apache/atlas/hive/hook/HiveHook.java    |  3 +++
 release-log.txt                                 |  1 +
 3 files changed, 18 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d0a9b999/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
----------------------------------------------------------------------
diff --git a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
index fcc45ab..e0d8024 100755
--- a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
+++ b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
@@ -123,7 +123,10 @@ public class HiveMetaStoreBridge {
         List<String> databases = hiveClient.getAllDatabases();
         for (String databaseName : databases) {
             Referenceable dbReference = registerDatabase(databaseName);
-            importTables(dbReference, databaseName, failOnError);
+
+            if (dbReference != null) {
+                importTables(dbReference, databaseName, failOnError);
+            }
         }
     }
 
@@ -146,13 +149,16 @@ public class HiveMetaStoreBridge {
     private Referenceable registerDatabase(String databaseName) throws Exception {
         Referenceable dbRef = getDatabaseReference(clusterName, databaseName);
         Database db = hiveClient.getDatabase(databaseName);
-        if (dbRef == null) {
-            dbRef = createDBInstance(db);
-            dbRef = registerInstance(dbRef);
-        } else {
-            LOG.info("Database {} is already registered with id {}. Updating it.", databaseName,
dbRef.getId().id);
-            dbRef = createOrUpdateDBInstance(db, dbRef);
-            updateInstance(dbRef);
+
+        if (db != null) {
+            if (dbRef == null) {
+                dbRef = createDBInstance(db);
+                dbRef = registerInstance(dbRef);
+            } else {
+                LOG.info("Database {} is already registered with id {}. Updating it.", databaseName,
dbRef.getId().id);
+                dbRef = createOrUpdateDBInstance(db, dbRef);
+                updateInstance(dbRef);
+            }
         }
         return dbRef;
     }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d0a9b999/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java
----------------------------------------------------------------------
diff --git a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java
index cf2e865..e27e52c 100755
--- a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java
+++ b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java
@@ -499,6 +499,9 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext
{
 
         if (db != null) {
             db = dgiBridge.hiveClient.getDatabase(db.getName());
+        }
+
+        if (db != null) {
             Referenceable dbEntity = dgiBridge.createDBInstance(db);
 
             entities.add(dbEntity);

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/d0a9b999/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 334a1c5..c3ab28b 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -6,6 +6,7 @@ INCOMPATIBLE CHANGES:
 
 
 ALL CHANGES:
+ATLAS-1053 Fix issues flagged by Coverity scan - potential NPE (mneethiraj via sumasai)
 ATLAS-1052 Fix NPE in HiveHook due to null Session State (sumasai)
 ATLAS-1051 Sqoop Hook does not package HDFS model jars which is required (sumasai)
 ATLAS-1049 List types by supertype (shwethags via sumasai)


Mime
View raw message