GeezerVison is showing github.com — [google-auth-library-java] NullPointerException when APPDATA environment variable is unset on Windows in GoogleAuthUtils.getWellKnownCredentialsFile · Issue #12565 · googleapis/google-cloud-java
[google-auth-library-java] NullPointerException when APPDATA environment variable is unset on Windows in GoogleAuthUtils.getWellKnownCredentialsFile #12565
Labels
authpriority: p3Desirable enhancement or fix. May not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns. Description
In GoogleAuthUtils.getWellKnownCredentialsFile, when the OS is detected as Windows and the CLOUDSDK_CONFIG environment variable is not set, the code attempts to resolve the gcloud configuration directory using the APPDATA environment variable. If the APPDATA environment variable is missing, provider.getEnv("APPDATA") returns null.
Passing null to the new File(String) constructor instantly throws a raw NullPointerException. This causes the library to crash with an unhelpful stack overflow or server runtime crash, instead of failing gracefully with a FileNotFoundException or IOException.
Activity
changed the title
[-]NullPointerException when APPDATA environment variable is unset on Windows in GoogleAuthUtils.getWellKnownCredentialsFile[/-] [+][google-auth-library-java] NullPointerException when APPDATA environment variable is unset on Windows in GoogleAuthUtils.getWellKnownCredentialsFile[/+] on Apr 1, 2026added
type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p3Desirable enhancement or fix. May not be included in next release. and removed
priority: p2Moderately-important priority. Fix may not be included in next release. on Apr 22, 2026anishesg commented on Apr 25, 2026
Fix in #12913. Adds a null/empty/blank check for APPDATA before building the credentials path, and throws a descriptive error instead of an opaque NPE.
added 9 commits that reference this issue
on Jun 15, 2026This issue will close once commit bd0a18e is merged into the 'main' branch.bd0a18e This issue will close once commit 80f34d1 is merged into the 'main' branch.80f34d1 This issue will close once commit d16f348 is merged into the 'main' branch.d16f348 This issue will close once commit 623bd98 is merged into the 'main' branch.623bd98 This issue will close once commit 8bdd44a is merged into the 'main' branch.8bdd44a This issue will close once commit 4a787a0 is merged into the 'main' branch.4a787a0 This issue will close once commit 1fcbaa2 is merged into the 'main' branch.1fcbaa2 This issue will close once commit ee4c6d3 is merged into the 'main' branch.ee4c6d3 This issue will close once commit bd5a886 is merged into the 'main' branch.bd5a886 added a commit that references this issue
on Jun 17, 2026This issue will close once commit 77e84a9 is merged into the 'main' branch.77e84a9 added 2 commits that reference this issue
on Jun 30, 2026This issue will close once commit 5b49f07 is merged into the 'main' branch.5b49f07 This issue will close once commit 73c9a03 is merged into the 'main' branch.73c9a03
Metadata
Metadata
authpriority: p3Desirable enhancement or fix. May not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns. Development
No branches or pull requestsIssue actions