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 23
23
import com .google .cloud .spanner .SpannerExceptionFactory ;
24
24
import com .google .cloud .spanner .admin .instance .v1 .stub .GrpcInstanceAdminStub ;
25
25
import com .google .cloud .spanner .admin .instance .v1 .stub .InstanceAdminStubSettings ;
26
+ import com .google .common .base .Strings ;
26
27
import com .google .spanner .admin .instance .v1 .ListInstanceConfigsRequest ;
27
28
import java .time .Duration ;
28
29
@@ -42,14 +43,18 @@ class LocalConnectionChecker {
42
43
void checkLocalConnection (ConnectionOptions options ) {
43
44
final String emulatorHost = System .getenv ("SPANNER_EMULATOR_HOST" );
44
45
String host = options .getHost () == null ? emulatorHost : options .getHost ();
46
+ if (Strings .isNullOrEmpty (host )) {
47
+ return ;
48
+ }
49
+
45
50
if (host .startsWith ("https://" )) {
46
51
host = host .substring (8 );
47
52
}
48
53
if (host .startsWith ("http://" )) {
49
54
host = host .substring (7 );
50
55
}
51
56
// 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 ()) {
53
58
// Do a quick check to see if anything is actually running on the host.
54
59
try {
55
60
InstanceAdminStubSettings .Builder testEmulatorSettings =
You can’t perform that action at this time.
0 commit comments