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

JDK 8 bean support #327

Open
aropop opened this issue Mar 20, 2020 · 0 comments
Open

JDK 8 bean support #327

aropop opened this issue Mar 20, 2020 · 0 comments

Comments

@aropop
Copy link

aropop commented Mar 20, 2020

Describe the bug
Currently RxDocumentClientImpl uses a simple jackson object mapper, which does not support JDK8 classes like Optional.

To Reproduce

  • Create a bean with an Optional field
  • Store said bean

Expected behavior
It would serialize and deserialize correctly. Possible allow the user configure their own ObjectMapper to fix this.

Actual behavior

java.lang.ClassCastException: com.fasterxml.jackson.databind.node.TextNode cannot be cast to com.fasterxml.jackson.databind.node.ObjectNode
	at com.microsoft.azure.cosmosdb.JsonSerializable.fromJson(JsonSerializable.java:494) ~[azure-cosmosdb-commons-2.6.4.jar:na]
	at com.microsoft.azure.cosmosdb.JsonSerializable.<init>(JsonSerializable.java:78) ~[azure-cosmosdb-commons-2.6.4.jar:na]
	at com.microsoft.azure.cosmosdb.Resource.<init>(Resource.java:84) ~[azure-cosmosdb-commons-2.6.4.jar:na]
	at com.microsoft.azure.cosmosdb.Document.<init>(Document.java:63) ~[azure-cosmosdb-commons-2.6.4.jar:na]
	at com.microsoft.azure.cosmosdb.Document.FromObject(Document.java:72) ~[azure-cosmosdb-commons-2.6.4.jar:na]
	at com.microsoft.azure.cosmosdb.BridgeInternal.documentFromObject(BridgeInternal.java:56) ~[azure-cosmosdb-commons-2.6.4.jar:na]
	at com.microsoft.azure.cosmosdb.rx.internal.RxDocumentClientImpl.getCreateDocumentRequest(RxDocumentClientImpl.java:1031) ~[azure-cosmosdb-2.6.4.jar:na]
	at com.microsoft.azure.cosmosdb.rx.internal.RxDocumentClientImpl.createDocumentInternal(RxDocumentClientImpl.java:1164) ~[azure-cosmosdb-2.6.4.jar:na]
	at com.microsoft.azure.cosmosdb.rx.internal.RxDocumentClientImpl.lambda$createDocument$23(RxDocumentClientImpl.java:1155) ~[azure-cosmosdb-2.6.4.jar:na]
	at com.microsoft.azure.cosmosdb.rx.internal.ObservableHelper.lambda$inlineIfPossibleAsObs$1(ObservableHelper.java:55) ~[azure-cosmosdb-gateway-2.6.4.jar:na]
	at com.microsoft.azure.cosmosdb.rx.internal.BackoffRetryUtility.lambda$executeRetry$2(BackoffRetryUtility.java:102) ~[azure-cosmosdb-gateway-2.6.4.jar:na]

Environment summary
SDK Version: 2.6.4
Java JDK version: 8
OS Version (e.g. Windows, Linux, MacOSX): Windows

Additional context
/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant