File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 2323import com .google .cloud .spanner .SpannerExceptionFactory ;
2424import com .google .cloud .spanner .admin .instance .v1 .stub .GrpcInstanceAdminStub ;
2525import com .google .cloud .spanner .admin .instance .v1 .stub .InstanceAdminStubSettings ;
26+ import com .google .common .base .Strings ;
2627import com .google .spanner .admin .instance .v1 .ListInstanceConfigsRequest ;
2728import java .time .Duration ;
2829
@@ -42,14 +43,18 @@ class LocalConnectionChecker {
4243 void checkLocalConnection (ConnectionOptions options ) {
4344 final String emulatorHost = System .getenv ("SPANNER_EMULATOR_HOST" );
4445 String host = options .getHost () == null ? emulatorHost : options .getHost ();
46+ if (Strings .isNullOrEmpty (host )) {
47+ return ;
48+ }
49+
4550 if (host .startsWith ("https://" )) {
4651 host = host .substring (8 );
4752 }
4853 if (host .startsWith ("http://" )) {
4954 host = host .substring (7 );
5055 }
5156 // Only do the check if the host has been set to localhost.
52- if (host != null && host .startsWith ("localhost" ) && options .isUsePlainText ()) {
57+ if (host .startsWith ("localhost" ) && options .isUsePlainText ()) {
5358 // Do a quick check to see if anything is actually running on the host.
5459 try {
5560 InstanceAdminStubSettings .Builder testEmulatorSettings =
You can’t perform that action at this time.
0 commit comments