|
22 | 22 | import java.time.format.DateTimeFormatter; |
23 | 23 | import java.util.*; |
24 | 24 | import java.util.function.Function; |
| 25 | + |
| 26 | +import com.google.common.base.Strings; |
25 | 27 | import org.slf4j.Logger; |
26 | 28 | import org.slf4j.LoggerFactory; |
27 | 29 |
|
@@ -219,7 +221,7 @@ private Response executeInner(Request in, String path) { |
219 | 221 | // after the first invocation to config.authenticate() |
220 | 222 | String userAgent = UserAgent.asString(); |
221 | 223 | String authType = getAuthTypeFunc.apply(null); |
222 | | - if (authType != "") { |
| 224 | + if (!Strings.isNullOrEmpty(authType)) { |
223 | 225 | userAgent += String.format(" auth/%s", authType); |
224 | 226 | } |
225 | 227 | in.withHeader("User-Agent", userAgent); |
@@ -247,12 +249,12 @@ private Response executeInner(Request in, String path) { |
247 | 249 | } |
248 | 250 | if (attemptNumber == maxAttempts) { |
249 | 251 | throw new DatabricksException( |
250 | | - String.format("Request %s failed after %d retries", in, maxAttempts), err); |
| 252 | + String.format("Request %s failed after %d retries", in, maxAttempts), databricksError); |
251 | 253 | } |
252 | 254 |
|
253 | 255 | // Retry after a backoff. |
254 | 256 | long sleepMillis = getBackoffMillis(out, attemptNumber); |
255 | | - LOG.debug(String.format("Retry %s in %dms", in.getRequestLine(), sleepMillis)); |
| 257 | + LOG.debug(String.format("Retry %s in %dms", in.getRequestLine(), sleepMillis), databricksError); |
256 | 258 | try { |
257 | 259 | timer.sleep(sleepMillis); |
258 | 260 | } catch (InterruptedException ex) { |
|
0 commit comments