Skip to content

Commit fbe6fb1

Browse files
committed
updated javadoc
1 parent 024fa0a commit fbe6fb1

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);
@@ -1613,9 +1618,9 @@ public Builder useClientCert(String clientCertificate, String clientCertificateK
16131618
}
16141619

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

0 commit comments

Comments
 (0)