azure-sdk-for-java icon indicating copy to clipboard operation
azure-sdk-for-java copied to clipboard

The java doc for the Cosmos Client Builder is erroneous

Open DavideDelVecchio opened this issue 3 years ago • 1 comments

The Cosmos Java SDK for the class sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosClientBuilder.java gives the following Building Cosmos Async Client with customizations example

CosmosAsyncClient client = new CosmosClientBuilder() .endpoint(serviceEndpoint) .key(key) .directMode(directConnectionConfig, gatewayConnectionConfig) .consistencyLevel(ConsistencyLevel.SESSION) .connectionSharingAcrossClientsEnabled(true) .contentResponseOnWriteEnabled(true) .userAgentSuffix("my-application1-client") .preferredRegions(Collections.singletonList("West US", "East US")) .buildAsyncClient();

When passing the preferredRegions the Collections.singletonList("West US", "East US") can only accept one element as per https://docs.oracle.com/javase/8/docs/api/java/util/Collections.html#singletonList-T- like in Collections.singletonList("West US") so two regions must be passed differently

DavideDelVecchio avatar Jun 15 '23 18:06 DavideDelVecchio

Will include fix here - https://github.com/Azure/azure-sdk-for-java/pull/35501

FabianMeiswinkel avatar Jun 16 '23 07:06 FabianMeiswinkel