From 285a4d8244a678e48f95adfe4433e2560f9bae97 Mon Sep 17 00:00:00 2001 From: Chi Wang Date: Mon, 26 Jun 2023 05:50:30 -0700 Subject: [PATCH] Properly handle invalid credential files 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 --- .../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); }