Commit 24785a49 authored by Guus der Kinderen's avatar Guus der Kinderen

OF-1322: Preventing a NPE, removing an unneeded nullcheck.

parent a469be3e
...@@ -195,14 +195,12 @@ public class SASLAuthentication { ...@@ -195,14 +195,12 @@ public class SASLAuthentication {
boolean trustedCert = false; boolean trustedCert = false;
if (session.isSecure()) { if (session.isSecure()) {
final LocalClientSession localClientSession = (LocalClientSession)session; final LocalClientSession localClientSession = (LocalClientSession)session;
if (localClientSession != null) { final Connection connection = localClientSession.getConnection();
final Connection connection = localClientSession.getConnection(); final KeyStore keyStore = connection.getConfiguration().getIdentityStore().getStore();
final KeyStore keyStore = connection.getConfiguration().getIdentityStore().getStore(); final KeyStore trustStore = connection.getConfiguration().getTrustStore().getStore();
final KeyStore trustStore = connection.getConfiguration().getTrustStore().getStore(); final X509Certificate trusted = CertificateManager.getEndEntityCertificate(connection.getPeerCertificates(), keyStore, trustStore);
final X509Certificate trusted = CertificateManager.getEndEntityCertificate(connection.getPeerCertificates(), keyStore, trustStore); if (trusted != null) {
if (trusted != null) { trustedCert = true;
trustedCert = true;
}
} }
} }
if (trustedCert == false) { if (trustedCert == false) {
......
...@@ -184,7 +184,7 @@ public class CertificateManager { ...@@ -184,7 +184,7 @@ public class CertificateManager {
*/ */
public static X509Certificate getEndEntityCertificate(Certificate chain[], public static X509Certificate getEndEntityCertificate(Certificate chain[],
KeyStore certStore, KeyStore trustStore) { KeyStore certStore, KeyStore trustStore) {
if (chain.length == 0) { if (chain == null || chain.length == 0) {
return null; return null;
} }
X509Certificate first = (X509Certificate) chain[0]; X509Certificate first = (X509Certificate) chain[0];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment