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

Deserializing BigDecimal throws exception #75

Closed
CluEleSsUK opened this issue Sep 20, 2017 · 8 comments
Closed

Deserializing BigDecimal throws exception #75

CluEleSsUK opened this issue Sep 20, 2017 · 8 comments
Assignees

Comments

@CluEleSsUK
Copy link

Inside CustomClassMapper in method deserializeToClass(Object obj, Class<T> clazz), the conditional statement wrongly assumes the value is of primitive type if Number.class.isAssignableFrom(clazz).
BigDecimal returns true but is not primitive, and throws an IllegalArgumentException in deserializeToPrimitive(Object obj, Class<T> clazz)

@hiranya911
Copy link
Contributor

Thanks for pointing this out @CluEleSsUK. If you can please provide us a pull request to fix this. Otherwise I will take a look in a couple of days.

@CluEleSsUK
Copy link
Author

CluEleSsUK commented Sep 20, 2017 via email

@ghajba
Copy link

ghajba commented Oct 7, 2017

A question to this topic: how should a BigDecimal/BigInteger be serialized?

I am currently facing the same issue, and I want to fix it, but I don't just want to hack something together.

@schmidt-sebastian
Copy link
Contributor

We are taking a look at this internally as this affects Android as well.

@schmidt-sebastian
Copy link
Contributor

I have pushed PRs to provide better error messages. Unfortunately, this will only marginally improve your experience with BigDecimal/BigInteger. Our backend does not support integer precision for numbers that exceed the 64bit signed range. If you do need to store larger numbers, please use "double" instead.

@hiranya911
Copy link
Contributor

@schmidt-sebastian are you going to implement any changes in the Admin SDK code?

@schmidt-sebastian
Copy link
Contributor

schmidt-sebastian commented Mar 15, 2019

We are only updating our error messages: googleapis/google-cloud-java#4675.

For now, the best work around is using double or Strings, both of which round-trip well between other clients and the backend.

@hiranya911
Copy link
Contributor

As of now we don't plan to support serialization of these types in RTDB. But we can revisit this issue if there's more interest.

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

No branches or pull requests

4 participants