File tree Expand file tree Collapse file tree
java-spanner/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -802,13 +802,16 @@ && getInitialConnectionPropertyValue(OAUTH_TOKEN) == null
802802 this .credentials =
803803 new GoogleCredentials (
804804 new AccessToken (getInitialConnectionPropertyValue (OAUTH_TOKEN ), null ));
805- } else if ((isSpannerOmniPattern || isSpannerOmni ())
806- && !Strings .isNullOrEmpty (username )
807- && !Strings .isNullOrEmpty (password )) {
808- SecretBytes secretBytes = SpannerOmniCredentials .convertToSecretBytes (password .toCharArray ());
809- this .credentials = new SpannerOmniCredentials (username , secretBytes , this .host );
810- } else if ((isSpannerOmniPattern || isSpannerOmni ()) && defaultSpannerOmniCredentials != null ) {
811- this .credentials = defaultSpannerOmniCredentials ;
805+ } else if (isSpannerOmniPattern || isSpannerOmni ()) {
806+ if (!Strings .isNullOrEmpty (username ) && !Strings .isNullOrEmpty (password )) {
807+ SecretBytes secretBytes =
808+ SpannerOmniCredentials .convertToSecretBytes (password .toCharArray ());
809+ this .credentials = new SpannerOmniCredentials (username , secretBytes , this .host );
810+ } else if (defaultSpannerOmniCredentials != null ) {
811+ this .credentials = defaultSpannerOmniCredentials ;
812+ } else {
813+ this .credentials = NoCredentials .getInstance ();
814+ }
812815 } else if (getInitialConnectionPropertyValue (CREDENTIALS_PROVIDER ) != null ) {
813816 try {
814817 this .credentials = getInitialConnectionPropertyValue (CREDENTIALS_PROVIDER ).getCredentials ();
You can’t perform that action at this time.
0 commit comments