HADOOP-10732. Fix locking in credential update. (Ted Yu via omalley)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1611416 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
27e2008484
commit
4dd217a8c1
|
@ -28,6 +28,8 @@ Release 2.6.0 - UNRELEASED
|
|||
HADOOP-10607. Create an API to separate credentials/password storage
|
||||
from applications (Larry McCay via omalley)
|
||||
|
||||
HADOOP-10732. Fix locking in credential update. (Ted Yu via omalley)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
BUG FIXES
|
||||
|
|
|
@ -230,6 +230,7 @@ public class JavaKeyStoreProvider extends CredentialProvider {
|
|||
|
||||
CredentialEntry innerSetCredential(String alias, char[] material)
|
||||
throws IOException {
|
||||
writeLock.lock();
|
||||
try {
|
||||
keyStore.setKeyEntry(alias, new SecretKeySpec(
|
||||
new String(material).getBytes("UTF-8"), "AES"),
|
||||
|
@ -237,6 +238,8 @@ public class JavaKeyStoreProvider extends CredentialProvider {
|
|||
} catch (KeyStoreException e) {
|
||||
throw new IOException("Can't store credential " + alias + " in " + this,
|
||||
e);
|
||||
} finally {
|
||||
writeLock.unlock();
|
||||
}
|
||||
changed = true;
|
||||
return new CredentialEntry(alias, material);
|
||||
|
|
Loading…
Reference in New Issue