@@ -116,13 +116,12 @@ final class ProtocolNegotiators {
116116 EnumSet .of (
117117 TlsServerCredentials .Feature .MTLS , TlsServerCredentials .Feature .CUSTOM_MANAGERS );
118118 private static Class <?> x509ExtendedTrustManagerClass ;
119- private static final Logger logger = Logger . getLogger ( ProtocolNegotiators . class . getName ());
119+
120120 static {
121121 try {
122122 x509ExtendedTrustManagerClass = Class .forName ("javax.net.ssl.X509ExtendedTrustManager" );
123123 } catch (ClassNotFoundException e ) {
124- logger .info ("javax.net.ssl.X509ExtendedTrustManager is not available. Authority override via call options" +
125- "via call options will not be allowed." );
124+ // Will disallow per-rpc authority override via call option.
126125 }
127126 }
128127
@@ -591,17 +590,20 @@ protected void userEventTriggered0(ChannelHandlerContext ctx, Object evt) throws
591590
592591 static final class ClientTlsProtocolNegotiator implements ProtocolNegotiator {
593592 private static final Logger logger = Logger .getLogger (ClientTlsProtocolNegotiator .class .getName ());
594- private static Method checkServerTrustedMethod ;
593+ private static final Method checkServerTrustedMethod ;
595594 static {
595+ Method method = null ;
596596 try {
597597 Class <?> x509ExtendedTrustManagerClass = Class .forName ("javax.net.ssl.X509ExtendedTrustManager" );
598- checkServerTrustedMethod = x509ExtendedTrustManagerClass .getMethod ("checkServerTrusted" ,
598+ method = x509ExtendedTrustManagerClass .getMethod ("checkServerTrusted" ,
599599 X509Certificate [].class , String .class , SSLEngine .class );
600600 } catch (ClassNotFoundException e ) {
601601 } catch (NoSuchMethodException e ) {
602602 // Should never happen.
603- logger .warning ("Method checkServerTrusted not found in javax.net.ssl.X509ExtendedTrustManager" );
603+ logger .log (Level .WARNING , "Method checkServerTrusted not found in " +
604+ "javax.net.ssl.X509ExtendedTrustManager" , e );
604605 }
606+ checkServerTrustedMethod = method ;
605607 }
606608
607609 @ GuardedBy ("this" )
@@ -669,10 +671,13 @@ public synchronized Status verifyAuthority(@Nonnull String authority) {
669671 try {
670672 verifyAuthorityAllowedForPeerCert (authority );
671673 peerVerificationStatus = Status .OK ;
672- } catch (SSLPeerUnverifiedException | CertificateException | InvocationTargetException | IllegalAccessException e ) {
674+ } catch (SSLPeerUnverifiedException | CertificateException | InvocationTargetException |
675+ IllegalAccessException | IllegalStateException e ) {
673676 peerVerificationStatus = Status .UNAVAILABLE .withDescription (
674677 String .format ("Peer hostname verification during rpc failed for authority '%s'" ,
675678 authority )).withCause (e );
679+ logger .log (Level .WARNING , "Authority verification failed (this will be an error in the "
680+ + "future)." , e );
676681 }
677682 peerVerificationResults .put (authority , peerVerificationStatus );
678683 return peerVerificationStatus ;
0 commit comments