Skip to content

Commit 44f2412

Browse files
committed
Address review comments.
1 parent 040035b commit 44f2412

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

netty/src/main/java/io/grpc/netty/NettyClientTransport.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ class NettyClientTransport implements ConnectionClientTransport {
108108
private final ChannelLogger channelLogger;
109109
private final boolean useGetForSafeMethods;
110110
private final Ticker ticker;
111-
private final Logger logger = Logger.getLogger(NettyClientTransport.class.getName());
112111

113112
NettyClientTransport(
114113
SocketAddress address,
@@ -204,9 +203,6 @@ public ClientStream newStream(
204203
if (enablePerRpcAuthorityCheck) {
205204
return new FailingClientStream(verificationStatus, tracers);
206205
}
207-
logger.warning(String.format("Authority verification for the rpc %s failed (this will be an" +
208-
" error in the future) with error status: %s", method.getFullMethodName(),
209-
verificationStatus.getDescription()));
210206
}
211207
}
212208
StatsTraceContext statsTraceCtx =

netty/src/main/java/io/grpc/netty/ProtocolNegotiators.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)