Skip to content

Commit 22d25df

Browse files
committed
addressed comments
1 parent 222a66e commit 22d25df

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

databricks-sdk-java/src/main/java/com/databricks/sdk/core/AzureMsiCredentialsProvider.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,12 @@ public OAuthHeaderFactory configure(DatabricksConfig config) {
6363
}
6464

6565
/**
66-
* Null-safe check for the azureUseMsi config flag. The underlying field is a boxed Boolean, but
67-
* the getter auto-unboxes to primitive boolean, which would NPE when the field is null. This
68-
* helper treats null as false.
66+
* Null-safe check for the azureUseMsi config flag. The underlying field is a boxed Boolean, so we
67+
* avoid auto-unboxing which would NPE when the field is null.
6968
*/
7069
private static boolean isAzureUseMsi(DatabricksConfig config) {
71-
try {
72-
return config.getAzureUseMsi();
73-
} catch (NullPointerException e) {
74-
return false;
75-
}
70+
Boolean flag = config.getAzureUseMsi();
71+
return flag != null && flag;
7672
}
7773

7874
/**

databricks-sdk-java/src/main/java/com/databricks/sdk/core/DatabricksConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ public DatabricksConfig setAzureWorkspaceResourceId(String azureWorkspaceResourc
504504
return this;
505505
}
506506

507-
public boolean getAzureUseMsi() {
507+
public Boolean getAzureUseMsi() {
508508
return azureUseMsi;
509509
}
510510

0 commit comments

Comments
 (0)