[BUG] KeyVaultClient.getAccessToken() may generate NullPointerException #44508
Labels
bug
This issue requires a change to an existing behavior in the product in order to be resolved.
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
KeyVault
needs-team-attention
Workflow: This issue needs attention from Azure service team or SDK team
Describe the bug
The private getAccessToken() method of the KeyVaultClient class generates a NullPointerException if it cannot get an access token. There is no protection against the use case where the HTTP request fails to fetch an access token, the code considers to get such an object whatever the HTTP response, as illustrated below:
Exception or Stack Trace
To Reproduce
Any failure to contact the token endpoint or to get an access token due to insufficient rights leads to that unexpected and unintelligible error.
Code Snippet
Expected behavior
I would expect to get a specialized type of exception, giving the reason of the failure, rather than a very obscur NullPointerException from which we cannot recover.
Screenshots
N/A
Setup (please complete the following information):
Additional context
N/A
Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
The text was updated successfully, but these errors were encountered: