Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

Core: ServiceOptions.setCredentials fails with ClassCastException when using UserCredentials #123

Closed
vladimir-lu opened this issue Jan 9, 2020 · 1 comment · Fixed by #124
Assignees
Labels
priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. 🚨 This issue needs some love. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@vladimir-lu
Copy link

On line

this.quotaProjectId = ((ServiceAccountCredentials) credentials).getQuotaProjectId();
the check is instanceof QuotaProjectIdProvider but the cast is to ServiceAccountCredentials therefore you get

class com.google.auth.oauth2.UserCredentials cannot be cast to class com.google.auth.oauth2.ServiceAccountCredentials (com.google.auth.oauth2.UserCredentials and com.google.auth.oauth2.ServiceAccountCredentials are in unnamed module of loader 'app')

The cast needs to be changed. google-cloud-core version 1.92.0

@chingor13 chingor13 added priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Jan 9, 2020
@chingor13
Copy link
Contributor

Thanks for finding this and reporting it! It's definitely a bug and we'll fix and push a release.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. 🚨 This issue needs some love. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants