Skip to content

Commit 19583a7

Browse files
committed
Check hostname not null or empty.
1 parent 7f26712 commit 19583a7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

s2a/src/main/java/io/grpc/s2a/handshaker/S2AProtocolNegotiatorFactory.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616

1717
package io.grpc.s2a.handshaker;
1818

19+
import static com.google.common.base.Preconditions.checkArgument;
1920
import static com.google.common.base.Preconditions.checkNotNull;
21+
import static com.google.common.base.Strings.isNullOrEmpty;
2022

2123
import com.google.common.annotations.VisibleForTesting;
2224
import com.google.common.net.HostAndPort;
@@ -131,7 +133,7 @@ public AsciiString scheme() {
131133
public ChannelHandler newHandler(GrpcHttp2ConnectionHandler grpcHandler) {
132134
checkNotNull(grpcHandler, "grpcHandler should not be null.");
133135
String hostname = getHostNameFromAuthority(grpcHandler.getAuthority());
134-
checkNotNull(hostname, "hostname should not be null.");
136+
checkArgument(!isNullOrEmpty(hostname), "hostname should not be null or empty.");
135137
return new S2AProtocolNegotiationHandler(
136138
grpcHandler, channelPool, localIdentity, hostname, service);
137139
}

0 commit comments

Comments
 (0)