Skip to content

Commit 7fccff9

Browse files
committed
Update exception handling
1 parent 408f3b4 commit 7fccff9

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ public CliTokenSource(
4848
* @throws DateTimeParseException if the input string cannot be parsed
4949
*/
5050
static Instant parseExpiry(String expiry) {
51-
DateTimeParseException lastException = null;
51+
DateTimeParseException parseException;
5252
try {
5353
return OffsetDateTime.parse(expiry).toInstant();
5454
} catch (DateTimeParseException e) {
55-
lastException = e;
55+
parseException = e;
5656
}
5757

5858
String multiplePrecisionPattern =
@@ -65,10 +65,11 @@ static Instant parseExpiry(String expiry) {
6565
LocalDateTime dateTime = LocalDateTime.parse(expiry, formatter);
6666
return dateTime.atZone(ZoneId.systemDefault()).toInstant();
6767
} catch (DateTimeParseException e) {
68-
lastException = e;
68+
parseException.addSuppressed(e);
6969
}
7070
}
71-
throw lastException;
71+
72+
throw parseException;
7273
}
7374

7475
private String getProcessStream(InputStream stream) throws IOException {

0 commit comments

Comments
 (0)