Skip to content

Commit 3dc2866

Browse files
committed
Deleted Util function
1 parent 0940133 commit 3dc2866

File tree

3 files changed

+20
-29
lines changed

3 files changed

+20
-29
lines changed

src/main/java/com/databricks/jdbc/client/http/DatabricksHttpClient.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import com.databricks.jdbc.client.DatabricksRetryHandlerException;
99
import com.databricks.jdbc.client.IDatabricksHttpClient;
1010
import com.databricks.jdbc.commons.LogLevel;
11-
import com.databricks.jdbc.commons.util.HttpExecuteExceptionUtil;
1211
import com.databricks.jdbc.commons.util.LoggingUtil;
1312
import com.databricks.jdbc.driver.IDatabricksConnectionContext;
1413
import com.databricks.sdk.core.DatabricksConfig;
@@ -348,7 +347,7 @@ public CloseableHttpResponse execute(HttpUriRequest request) throws DatabricksHt
348347
try {
349348
return httpClient.execute(request);
350349
} catch (IOException e) {
351-
HttpExecuteExceptionUtil.throwException(e, request);
350+
throwHttpException(e, request);
352351
}
353352
return null;
354353
}
@@ -361,7 +360,7 @@ public CloseableHttpResponse executeWithoutSSL(HttpUriRequest request)
361360
try {
362361
return httpDisabledSSLClient.execute(request);
363362
} catch (Exception e) {
364-
HttpExecuteExceptionUtil.throwException(e, request);
363+
throwHttpException(e, request);
365364
}
366365
return null;
367366
}
@@ -413,4 +412,21 @@ public static synchronized void removeInstance(IDatabricksConnectionContext cont
413412
}
414413
}
415414
}
415+
416+
private static void throwHttpException(Exception e, HttpUriRequest request)
417+
throws DatabricksHttpException {
418+
Throwable cause = e;
419+
while (cause != null) {
420+
if (cause instanceof DatabricksRetryHandlerException) {
421+
throw new DatabricksHttpException(cause.getMessage(), cause);
422+
}
423+
cause = cause.getCause();
424+
}
425+
String errorMsg =
426+
String.format(
427+
"Caught error while executing http request: [%s]. Error Message: [%s]",
428+
RequestSanitizer.sanitizeRequest(request), e);
429+
LoggingUtil.log(LogLevel.ERROR, errorMsg);
430+
throw new DatabricksHttpException(errorMsg, e);
431+
}
416432
}

src/main/java/com/databricks/jdbc/commons/util/HttpExecuteExceptionUtil.java

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/main/java/com/databricks/jdbc/telemetry/DatabricksMetrics.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ public String sendRequest(Map<String, Double> map, MetricsType metricsType) thro
9494
uriBuilder.addParameter(METRICS_TYPE, metricsType.name().equals("GAUGE") ? "1" : "0");
9595
HttpUriRequest request = new HttpPost(uriBuilder.build());
9696
// TODO (Bhuvan): Add authentication headers
97+
// TODO (Bhuvan): execute request using SSL
9798
CloseableHttpResponse response = telemetryClient.executeWithoutSSL(request);
9899

99100
// Error handling

0 commit comments

Comments
 (0)