HADOOP-12076. Incomplete Cache Mechanism in CredentialProvider API. Contributed by Larry McCay.
This commit is contained in:
parent
9cd5ad9d84
commit
fbf55dcaf4
@ -861,6 +861,9 @@ Release 2.8.0 - UNRELEASED
|
||||
HADOOP-12095. org.apache.hadoop.fs.shell.TestCount fails.
|
||||
(Brahma Reddy Battula via aajisaka)
|
||||
|
||||
HADOOP-12076. Incomplete Cache Mechanism in CredentialProvider API.
|
||||
(Larry McCay via cnauroth)
|
||||
|
||||
Release 2.7.1 - UNRELEASED
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
@ -41,9 +41,7 @@
|
||||
import java.security.cert.CertificateException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
@ -174,13 +172,6 @@ public KeyStore getKeyStore() {
|
||||
return keyStore;
|
||||
}
|
||||
|
||||
public Map<String, CredentialEntry> getCache() {
|
||||
return cache;
|
||||
}
|
||||
|
||||
private final Map<String, CredentialEntry> cache =
|
||||
new HashMap<String, CredentialEntry>();
|
||||
|
||||
protected final String getPathAsString() {
|
||||
return getPath().toString();
|
||||
}
|
||||
@ -213,9 +204,6 @@ public CredentialEntry getCredentialEntry(String alias)
|
||||
try {
|
||||
SecretKeySpec key = null;
|
||||
try {
|
||||
if (cache.containsKey(alias)) {
|
||||
return cache.get(alias);
|
||||
}
|
||||
if (!keyStore.containsAlias(alias)) {
|
||||
return null;
|
||||
}
|
||||
@ -269,7 +257,7 @@ public CredentialEntry createCredentialEntry(String alias, char[] credential)
|
||||
throws IOException {
|
||||
writeLock.lock();
|
||||
try {
|
||||
if (keyStore.containsAlias(alias) || cache.containsKey(alias)) {
|
||||
if (keyStore.containsAlias(alias)) {
|
||||
throw new IOException("Credential " + alias + " already exists in "
|
||||
+ this);
|
||||
}
|
||||
@ -296,7 +284,6 @@ public void deleteCredentialEntry(String name) throws IOException {
|
||||
} catch (KeyStoreException e) {
|
||||
throw new IOException("Problem removing " + name + " from " + this, e);
|
||||
}
|
||||
cache.remove(name);
|
||||
changed = true;
|
||||
} finally {
|
||||
writeLock.unlock();
|
||||
|
Loading…
Reference in New Issue
Block a user