HADOOP-11355. When accessing data in HDFS and the key has been deleted, a Null Pointer Exception is shown. Contributed by Arun Suresh.
(cherry picked from commit 9cdaec6a6f
)
This commit is contained in:
parent
6afc75f87b
commit
b8e4fffa49
|
@ -142,6 +142,9 @@ Release 2.7.0 - UNRELEASED
|
||||||
HADOOP-11348. Remove unused variable from CMake error message for finding
|
HADOOP-11348. Remove unused variable from CMake error message for finding
|
||||||
openssl (Dian Fu via Colin P. McCabe)
|
openssl (Dian Fu via Colin P. McCabe)
|
||||||
|
|
||||||
|
HADOOP-11355. When accessing data in HDFS and the key has been deleted,
|
||||||
|
a Null Pointer Exception is shown. (Arun Suresh via wang)
|
||||||
|
|
||||||
Release 2.6.0 - 2014-11-18
|
Release 2.6.0 - 2014-11-18
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -240,6 +240,10 @@ public class KeyAuthorizationKeyProvider extends KeyProviderCryptoExtension {
|
||||||
String kn = ekv.getEncryptionKeyName();
|
String kn = ekv.getEncryptionKeyName();
|
||||||
String kvn = ekv.getEncryptionKeyVersionName();
|
String kvn = ekv.getEncryptionKeyVersionName();
|
||||||
KeyVersion kv = provider.getKeyVersion(kvn);
|
KeyVersion kv = provider.getKeyVersion(kvn);
|
||||||
|
if (kv == null) {
|
||||||
|
throw new IllegalArgumentException(String.format(
|
||||||
|
"'%s' not found", kvn));
|
||||||
|
}
|
||||||
if (!kv.getName().equals(kn)) {
|
if (!kv.getName().equals(kn)) {
|
||||||
throw new IllegalArgumentException(String.format(
|
throw new IllegalArgumentException(String.format(
|
||||||
"KeyVersion '%s' does not belong to the key '%s'", kvn, kn));
|
"KeyVersion '%s' does not belong to the key '%s'", kvn, kn));
|
||||||
|
|
|
@ -498,6 +498,14 @@ public class TestKMS {
|
||||||
// deleteKey()
|
// deleteKey()
|
||||||
kp.deleteKey("k1");
|
kp.deleteKey("k1");
|
||||||
|
|
||||||
|
// Check decryption after Key deletion
|
||||||
|
try {
|
||||||
|
kpExt.decryptEncryptedKey(ek1);
|
||||||
|
Assert.fail("Should not be allowed !!");
|
||||||
|
} catch (Exception e) {
|
||||||
|
Assert.assertTrue(e.getMessage().contains("'k1@1' not found"));
|
||||||
|
}
|
||||||
|
|
||||||
// getKey()
|
// getKey()
|
||||||
Assert.assertNull(kp.getKeyVersion("k1"));
|
Assert.assertNull(kp.getKeyVersion("k1"));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue