hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From z..@apache.org
Subject hadoop git commit: HDFS-10809. getNumEncryptionZones causes NPE in branch-2.7. Contributed by Vinitha Reddy Gankidi.
Date Tue, 30 Aug 2016 18:47:10 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2.7 d499a8ccc -> 85a067fd6


HDFS-10809. getNumEncryptionZones causes NPE in branch-2.7. Contributed by Vinitha Reddy Gankidi.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/85a067fd
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/85a067fd
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/85a067fd

Branch: refs/heads/branch-2.7
Commit: 85a067fd6bdd4af69c1fe0c6de0211aac3b24db0
Parents: d499a8c
Author: Zhe Zhang <zhz@apache.org>
Authored: Tue Aug 30 11:46:52 2016 -0700
Committer: Zhe Zhang <zhz@apache.org>
Committed: Tue Aug 30 11:46:52 2016 -0700

----------------------------------------------------------------------
 .../hadoop/hdfs/server/namenode/EncryptionZoneManager.java       | 3 ++-
 .../test/java/org/apache/hadoop/hdfs/TestEncryptionZones.java    | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/85a067fd/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/EncryptionZoneManager.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/EncryptionZoneManager.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/EncryptionZoneManager.java
index b30b2f8..3adc5c7 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/EncryptionZoneManager.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/EncryptionZoneManager.java
@@ -390,7 +390,8 @@ public class EncryptionZoneManager {
    * @return number of encryption zones.
    */
   public int getNumEncryptionZones() {
-    return encryptionZones.size();
+    return hasCreatedEncryptionZone() ?
+        encryptionZones.size() : 0;
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/hadoop/blob/85a067fd/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestEncryptionZones.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestEncryptionZones.java
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestEncryptionZones.java
index 2a05a94..a30f396 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestEncryptionZones.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestEncryptionZones.java
@@ -217,7 +217,9 @@ public class TestEncryptionZones {
   public void testBasicOperations() throws Exception {
 
     int numZones = 0;
-
+    /* Number of EZs should be 0 if no EZ is created */
+    assertEquals("Unexpected number of encryption zones!", numZones,
+        cluster.getNamesystem().getNumEncryptionZones());
     /* Test failure of create EZ on a directory that doesn't exist. */
     final Path zoneParent = new Path("/zones");
     final Path zone1 = new Path(zoneParent, "zone1");


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message