]
Ilia Vassilev reassigned ELY-832:
---------------------------------
Assignee: Ilia Vassilev (was: Darran Lofthouse)
Coverity static analysis: Dereference null return value in
CredentialStoreCredentialSource (Elytron)
----------------------------------------------------------------------------------------------------
Key: ELY-832
URL:
https://issues.jboss.org/browse/ELY-832
Project: WildFly Elytron
Issue Type: Bug
Reporter: Josef Cacek
Assignee: Ilia Vassilev
Labels: static_analysis
Coverity static-analysis scan found possible method call on null object in
{{CredentialStoreCredentialSource.​getCredential(​)}}
https://scan7.coverity.com/reports.htm#v16159/p11778/fileInstanceId=68037...
The problematic piece of code is:
{code:java}
credential = credentialStore.retrieve(alias, credentialType);
return credential.castAs(credentialType, algorithmName, parameterSpec);
{code}
The {{retrieve()}} method may return {{null}} in some cases as can be seen in
{{KeyStoreCredentialStore}} class:
{code:java}
//...
final TopEntry topEntry = cache.get(credentialAlias);
if (topEntry == null) {
return null;
}
//...
{code}