HADOOP-14688. Intern strings in KeyVersion and EncryptedKeyVersion. Contributed by Xiao Chen.

This commit is contained in:
Wei-Chiu Chuang 2017-09-05 15:11:37 -07:00
parent ccd2ac60ec
commit ad32759fd9
2 changed files with 5 additions and 4 deletions

View File

@ -71,8 +71,8 @@ public abstract class KeyProvider {
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;
}

View File

@ -81,8 +81,9 @@ public class KeyProviderCryptoExtension extends
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;
}