File tree Expand file tree Collapse file tree 3 files changed +8
-11
lines changed
databricks-sdk-java/src/main/java/com/databricks/sdk/core Expand file tree Collapse file tree 3 files changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ private void addOIDCCredentialsProviders(DatabricksConfig config) {
118118 new EnvVarIDTokenSource (
119119 // Use configured environment variable name if set, otherwise default to
120120 // DATABRICKS_OIDC_TOKEN
121- ( Strings .isNullOrEmpty (config .getOidcTokenEnv () ))
121+ Strings .isNullOrEmpty (config .getOidcTokenEnv ())
122122 ? "DATABRICKS_OIDC_TOKEN"
123123 : config .getOidcTokenEnv (),
124124 config .getEnv ())));
Original file line number Diff line number Diff line change @@ -38,10 +38,6 @@ public IDToken getIDToken(String audience) {
3838 throw new IllegalArgumentException ("Environment variable name cannot be null or empty" );
3939 }
4040
41- if (env == null ) {
42- throw new IllegalArgumentException ("Environment cannot be null" );
43- }
44-
4541 try {
4642 String token = env .get (envVarName );
4743 return new IDToken (token );
Original file line number Diff line number Diff line change @@ -90,13 +90,14 @@ public IDToken getIDToken(String audience) {
9090 throw new DatabricksException ("File " + filePath + " is empty" );
9191 }
9292
93+ String token ;
94+ try {
95+ token = lines .get (0 ).trim ();
96+ } catch (IndexOutOfBoundsException e ) {
97+ throw new DatabricksException ("Invalid token format in file " + filePath );
98+ }
99+
93100 try {
94- String token ;
95- try {
96- token = lines .get (0 ).trim ();
97- } catch (IndexOutOfBoundsException e ) {
98- throw new DatabricksException ("Invalid token format in file " + filePath );
99- }
100101 return new IDToken (token );
101102 } catch (IllegalArgumentException e ) {
102103 throw new DatabricksException ("Received empty ID token from file " + filePath );
You can’t perform that action at this time.
0 commit comments