Skip to content

Commit 24e196e

Browse files
committed
updated javadoc
1 parent 74750a1 commit 24e196e

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerOptions.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,8 +1551,13 @@ public Builder setHost(String host) {
15511551

15521552
@ExperimentalApi("https://github.com/googleapis/java-spanner/pull/3676")
15531553
public Builder setExperimentalHost(String host) {
1554-
if (this.usePlainText && !host.startsWith("http")) {
1555-
host = "http://" + host;
1554+
if (this.usePlainText) {
1555+
Preconditions.checkArgument(
1556+
!host.startsWith("https:"),
1557+
"Please remove the 'https:' protocol prefix from the host string when using plain text communication");
1558+
if (!host.startsWith("http")) {
1559+
host = "http://" + host;
1560+
}
15561561
}
15571562
super.setHost(host);
15581563
super.setProjectId(EXPERIMENTAL_HOST_PROJECT_ID);
@@ -1619,9 +1624,9 @@ public Builder useClientCert(String clientCertificate, String clientCertificateK
16191624
}
16201625

16211626
/**
1622-
* {@code usePlainText} is only supported for experimental spanner hosts. This will configure
1623-
* the transport to use plaintext (no TLS) and will set credentials to {@link
1624-
* com.google.cloud.NoCredentials} to avoid sending authentication over an unsecured channel.
1627+
* {@code usePlainText} will configure the transport to use plaintext (no TLS) and will set
1628+
* credentials to {@link com.google.cloud.NoCredentials} to avoid sending authentication over an
1629+
* unsecured channel.
16251630
*/
16261631
@ExperimentalApi("https://github.com/googleapis/java-spanner/pull/4264")
16271632
public Builder usePlainText() {

0 commit comments

Comments
 (0)