Skip to content

Commit aa6a089

Browse files
committed
fix fmt
1 parent f000209 commit aa6a089

File tree

4 files changed

+26
-18
lines changed

4 files changed

+26
-18
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,8 +725,8 @@ public DatabricksConfig newWithWorkspaceHost(String host) {
725725

726726
/**
727727
* Gets the default OAuth redirect URL. If one is not provided explicitly, uses
728-
* http://localhost:8020, which is the default redirect URL for the default
729-
* client ID (databricks-cli).
728+
* http://localhost:8020, which is the default redirect URL for the default client ID
729+
* (databricks-cli).
730730
*
731731
* @return The OAuth redirect URL to use
732732
*/

databricks-sdk-java/src/main/java/com/databricks/sdk/core/oauth/ExternalBrowserCredentialsProvider.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ public OAuthHeaderFactory configure(DatabricksConfig config) {
6161
try {
6262
if (tokenCache == null) {
6363
// Create a default FileTokenCache based on config
64-
Path cachePath =
65-
TokenCacheUtils.getCacheFilePath(config.getHost(), clientId, scopes);
64+
Path cachePath = TokenCacheUtils.getCacheFilePath(config.getHost(), clientId, scopes);
6665
tokenCache = new FileTokenCache(cachePath);
6766
}
6867

@@ -105,7 +104,11 @@ public OAuthHeaderFactory configure(DatabricksConfig config) {
105104
}
106105

107106
SessionCredentials performBrowserAuth(
108-
DatabricksConfig config, String clientId, String clientSecret, List<String> scopes, TokenCache tokenCache)
107+
DatabricksConfig config,
108+
String clientId,
109+
String clientSecret,
110+
List<String> scopes,
111+
TokenCache tokenCache)
109112
throws IOException {
110113
LOGGER.debug("Performing browser authentication");
111114
OAuthClient client =

databricks-sdk-java/src/main/java/com/databricks/sdk/core/oauth/OAuthClient.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,16 @@ private static byte[] sha256(byte[] input) {
165165
private static String urlEncode(String urlBase, Map<String, String> params) {
166166
String queryParams =
167167
params.entrySet().stream()
168-
.map(entry -> {
169-
try {
170-
return URLEncoder.encode(entry.getKey(), StandardCharsets.UTF_8.toString()) +
171-
"=" +
172-
URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8.toString());
173-
} catch (Exception e) {
174-
throw new DatabricksException("Failed to URL encode parameters", e);
175-
}
176-
})
168+
.map(
169+
entry -> {
170+
try {
171+
return URLEncoder.encode(entry.getKey(), StandardCharsets.UTF_8.toString())
172+
+ "="
173+
+ URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8.toString());
174+
} catch (Exception e) {
175+
throw new DatabricksException("Failed to URL encode parameters", e);
176+
}
177+
})
177178
.collect(Collectors.joining("&"));
178179
return urlBase + "?" + queryParams;
179180
}

databricks-sdk-java/src/test/java/com/databricks/sdk/core/oauth/ExternalBrowserCredentialsProviderTest.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,8 @@ void cacheWithInvalidAccessTokenRefreshFailingTest() throws IOException {
436436
Mockito.spy(new ExternalBrowserCredentialsProvider(mockTokenCache));
437437
Mockito.doReturn(browserAuthCreds)
438438
.when(provider)
439-
.performBrowserAuth(any(DatabricksConfig.class), any(), any(), any(List.class), any(TokenCache.class));
439+
.performBrowserAuth(
440+
any(DatabricksConfig.class), any(), any(), any(List.class), any(TokenCache.class));
440441

441442
// Spy on the config to inject the endpoints
442443
DatabricksConfig spyConfig = Mockito.spy(config);
@@ -454,7 +455,8 @@ void cacheWithInvalidAccessTokenRefreshFailingTest() throws IOException {
454455

455456
// Verify performBrowserAuth was called since refresh failed
456457
Mockito.verify(provider, Mockito.times(1))
457-
.performBrowserAuth(any(DatabricksConfig.class), any(), any(), any(List.class), any(TokenCache.class));
458+
.performBrowserAuth(
459+
any(DatabricksConfig.class), any(), any(), any(List.class), any(TokenCache.class));
458460

459461
// Verify token was saved after browser auth (for the new token)
460462
Mockito.verify(mockTokenCache, Mockito.times(1)).save(any(Token.class));
@@ -497,7 +499,8 @@ void cacheWithInvalidTokensTest() throws IOException {
497499
Mockito.spy(new ExternalBrowserCredentialsProvider(mockTokenCache));
498500
Mockito.doReturn(browserAuthCreds)
499501
.when(provider)
500-
.performBrowserAuth(any(DatabricksConfig.class), any(), any(), any(List.class), any(TokenCache.class));
502+
.performBrowserAuth(
503+
any(DatabricksConfig.class), any(), any(), any(List.class), any(TokenCache.class));
501504

502505
// Configure provider
503506
HeaderFactory headerFactory = provider.configure(config);
@@ -510,7 +513,8 @@ void cacheWithInvalidTokensTest() throws IOException {
510513

511514
// Verify performBrowserAuth was called since we had an invalid token
512515
Mockito.verify(provider, Mockito.times(1))
513-
.performBrowserAuth(any(DatabricksConfig.class), any(), any(), any(List.class), any(TokenCache.class));
516+
.performBrowserAuth(
517+
any(DatabricksConfig.class), any(), any(), any(List.class), any(TokenCache.class));
514518

515519
// Verify token was saved after browser auth (for the new token)
516520
Mockito.verify(mockTokenCache, Mockito.times(1)).save(any(Token.class));

0 commit comments

Comments
 (0)