8206355: SSLSessionImpl.getLocalPrincipal() throws NPE

Fixed SSLSessionImpl.getLocalPrincipal() implementation when client side authentication is not enabled.

Reviewed-by: xuelei
This commit is contained in:
Sibabrata Sahoo 2018-07-04 11:49:46 -07:00
parent 7129c3e786
commit 99f911cc71
2 changed files with 345 additions and 1 deletions

View file

@ -658,7 +658,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
*/
@Override
public Principal getLocalPrincipal() {
return ((localCerts == null && localCerts.length != 0) ? null :
return ((localCerts == null || localCerts.length == 0) ? null :
localCerts[0].getSubjectX500Principal());
}