hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject hbase git commit: HBASE-12337 Import tool fails with NullPointerException if clusterIds is not initialized
Date Tue, 18 Nov 2014 17:21:27 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.98 5563105d1 -> 7d8f449e1


HBASE-12337 Import tool fails with NullPointerException if clusterIds is not initialized


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/7d8f449e
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/7d8f449e
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/7d8f449e

Branch: refs/heads/0.98
Commit: 7d8f449e18bc8783ef5f8488aea2dbe9a58d30eb
Parents: 5563105
Author: tedyu <yuzhihong@gmail.com>
Authored: Tue Nov 18 09:21:17 2014 -0800
Committer: tedyu <yuzhihong@gmail.com>
Committed: Tue Nov 18 09:21:17 2014 -0800

----------------------------------------------------------------------
 .../main/java/org/apache/hadoop/hbase/mapreduce/Import.java  | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/7d8f449e/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/Import.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/Import.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/Import.java
index 646fc61..3ed2061 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/Import.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/Import.java
@@ -225,18 +225,26 @@ public class Import {
       }
       // TODO: This is kind of ugly doing setup of ZKW just to read the clusterid.
       ZooKeeperWatcher zkw = null;
+      Exception ex = null;
       try {
         zkw = new ZooKeeperWatcher(conf, context.getTaskAttemptID().toString(), null);
         clusterIds = Collections.singletonList(ZKClusterId.getUUIDForCluster(zkw));
       } catch (ZooKeeperConnectionException e) {
+        ex = e;
         LOG.error("Problem connecting to ZooKeper during task setup", e);
       } catch (KeeperException e) {
+        ex = e;
         LOG.error("Problem reading ZooKeeper data during task setup", e);
       } catch (IOException e) {
+        ex = e;
         LOG.error("Problem setting up task", e);
       } finally {
         if (zkw != null) zkw.close();
       }
+      if (clusterIds == null) {
+        // exit early if setup fails
+        throw new RuntimeException(ex);
+      }
     }
   }
 


Mime
View raw message