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:18:34 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 3f6b73463 -> 0eb07609b


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/0eb07609
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/0eb07609
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/0eb07609

Branch: refs/heads/master
Commit: 0eb07609b66bec92d2f5479a1939f64ca3c8bdc0
Parents: 3f6b734
Author: tedyu <yuzhihong@gmail.com>
Authored: Tue Nov 18 09:18:25 2014 -0800
Committer: tedyu <yuzhihong@gmail.com>
Committed: Tue Nov 18 09:18:25 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/0eb07609/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 1033dac..15540c6 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
@@ -231,18 +231,26 @@ public class Import extends Configured implements Tool {
       }
       // 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