From 28312a9bf7cddfb219d255fba394c123b7f5664f Mon Sep 17 00:00:00 2001 From: "Ian (Hee) Cha" Date: Tue, 27 Jun 2023 01:25:00 -0700 Subject: [PATCH] Properly handle invalid credential files (#18779) to prevent Bazel sever from crashing. The functions used to construct credentials could throw runtime exception which will crash Bazel server in which case the Bazel client will just exit silently. Fixes #18755. Closes #18770. PiperOrigin-RevId: 543413376 Change-Id: I71238345f350caaac51f9cc9f654661a90cf6737 Co-authored-by: Chi Wang --- .../google/devtools/build/lib/authandtls/GoogleAuthUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/google/devtools/build/lib/authandtls/GoogleAuthUtils.java b/src/main/java/com/google/devtools/build/lib/authandtls/GoogleAuthUtils.java index 409263929c7cdc..70e235b394fbcf 100644 --- a/src/main/java/com/google/devtools/build/lib/authandtls/GoogleAuthUtils.java +++ b/src/main/java/com/google/devtools/build/lib/authandtls/GoogleAuthUtils.java @@ -330,7 +330,7 @@ public static Credentials newGoogleCredentialsFromFile( creds = creds.createScoped(authScopes); } return creds; - } catch (IOException e) { + } catch (Exception e) { String message = "Failed to init auth credentials: " + e.getMessage(); throw new IOException(message, e); }