Skip to content

Commit

Permalink
HADOOP-12076. Incomplete Cache Mechanism in CredentialProvider API. C…
Browse files Browse the repository at this point in the history
…ontributed by Larry McCay.
  • Loading branch information
cnauroth committed Jun 16, 2015
1 parent 9cd5ad9 commit fbf55dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
3 changes: 3 additions & 0 deletions hadoop-common-project/hadoop-common/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}
Expand All @@ -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();
Expand Down

0 comments on commit fbf55dc

Please sign in to comment.