HDFS-10809. getNumEncryptionZones causes NPE in branch-2.7. Contributed by Vinitha Reddy Gankidi.
This commit is contained in:
parent
d499a8cccf
commit
85a067fd6b
|
@ -390,7 +390,8 @@ public class EncryptionZoneManager {
|
|||
* @return number of encryption zones.
|
||||
*/
|
||||
public int getNumEncryptionZones() {
|
||||
return encryptionZones.size();
|
||||
return hasCreatedEncryptionZone() ?
|
||||
encryptionZones.size() : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue