diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyProvider.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyProvider.java index fb3dba4331..c1c371b6a4 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyProvider.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyProvider.java @@ -71,8 +71,8 @@ public static class KeyVersion { protected KeyVersion(String name, String versionName, byte[] material) { - this.name = name; - this.versionName = versionName; + this.name = name == null ? null : name.intern(); + this.versionName = versionName == null ? null : versionName.intern(); this.material = material; } diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyProviderCryptoExtension.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyProviderCryptoExtension.java index 8c879b3c14..693c7853ed 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyProviderCryptoExtension.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyProviderCryptoExtension.java @@ -81,8 +81,9 @@ public static class EncryptedKeyVersion { protected EncryptedKeyVersion(String keyName, String encryptionKeyVersionName, byte[] encryptedKeyIv, KeyVersion encryptedKeyVersion) { - this.encryptionKeyName = keyName; - this.encryptionKeyVersionName = encryptionKeyVersionName; + this.encryptionKeyName = keyName == null ? null : keyName.intern(); + this.encryptionKeyVersionName = encryptionKeyVersionName == null ? + null : encryptionKeyVersionName.intern(); this.encryptedKeyIv = encryptedKeyIv; this.encryptedKeyVersion = encryptedKeyVersion; }