Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix NPE when using deprecated Azure settings (#28769)
* Fix NPE when using deprecated Azure settings When someone migrates from 5.6 to 6.x with deprecated settings like: ``` cloud: azure: storage: foo: account: <my_account> key: <my_key> ``` It produces a NPE anytime someone wants to use a repository which name is not `default`. This has been introduced by #23518 when I backported it to 6.x branch. In this case, when we generate an OperationContext, we only try to get azure settings from "normal" `storageSettings` with: ```java this.storageSettings.get(clientName) ``` But in the context of deprecated settings, this returns `null` which causes the NPE just after. This commit adds a check and if no settings are found in the "normal" `storageSettings`, we look at settings from `deprecatedStorageSettings`. The reason I missed it in the 7.0 version (master branch) is because actually `deprecatedStorageSettings` has been removed there already. Also I renamed the `testGetSelectedClientDefault` method to `testGenerateOperationContext` as it was only doing exactly the same thing as `testGetDefaultClientWithPrimaryAndSecondaries`. Closes #28299. Backport of #28769 in 6.2 branch.
- Loading branch information