Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null pointer when using createContainerIfNotExists() #221

Open
jdubois opened this issue Jul 4, 2019 · 3 comments

Comments

@jdubois
Copy link

commented Jul 4, 2019

Describe the bug
I have a null pointer exception when doing database.createContainerIfNotExists(new CosmosContainerProperties(CONTAINER_NAME, "/partition"))

In fact this method calls this line:
https://github.com/Azure/azure-cosmosdb-java/blob/v3/sdk/src/main/java/com/azure/data/cosmos/CosmosDatabase.java#L250

Which uses a null value for the class CosmosContainerRequestOptions.

So when this line is called for creating a container: https://github.com/Azure/azure-cosmosdb-java/blob/v3/sdk/src/main/java/com/azure/data/cosmos/CosmosDatabase.java#L177 it does a options.toRequestOptions() which fails as the object is null.

Environment summary
SDK Version: 3.0.0
Java JDK version: openjdk version "11.0.3" 2019-04-16
OS Version (e.g. Windows, Linux, MacOSX): MacOSX

@jdubois

This comment has been minimized.

Copy link
Author

commented Jul 4, 2019

Interestingly, the method createContainerIfNotExists(CosmosContainerProperties containerSettings, int throughput) (which is just the same but with the thoughput added) doesn't have the issue, so just setting the throughput fixes the issue for me.

I'll propose a patch, as this is really simple.

@christopheranderson

This comment has been minimized.

Copy link
Member

commented Jul 5, 2019

I probably caused this bug when I was fixing up the overloads for some things to not require request options.

@christopheranderson christopheranderson moved this from To do to Review in progress in Cosmos DB SDK team Jul 18, 2019

@christopheranderson christopheranderson moved this from Review in progress to Done in Cosmos DB SDK team Jul 18, 2019

@christopheranderson

This comment has been minimized.

Copy link
Member

commented Aug 20, 2019

@mbhaskar - can you check if this is fixed yet? He has a PR out that fixes it that we can port to the new repo if not. If we have fixed it, please close this issue.

@christopheranderson christopheranderson moved this from Done to To do in Cosmos DB SDK team Aug 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.