Skip to content

Commit f751d11

Browse files
Update Consent.java
1 parent 346ffae commit f751d11

File tree

1 file changed

+7
-4
lines changed
  • databricks-sdk-java/src/main/java/com/databricks/sdk/core/oauth

1 file changed

+7
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,13 @@ private Map<String, String> getOAuthCallbackParameters() throws IOException {
239239
HttpServer.create(new InetSocketAddress(redirect.getHost(), redirect.getPort()), 0);
240240
httpServer.createContext("/", handler);
241241
httpServer.start();
242-
desktopBrowser();
243-
Map<String, String> params = handler.getParams();
244-
httpServer.stop(0);
245-
return params;
242+
243+
try {
244+
desktopBrowser();
245+
return handler.getParams();
246+
} finally {
247+
httpServer.stop(0);
248+
}
246249
}
247250

248251
/**

0 commit comments

Comments
 (0)