[ https://issues.apache.org/jira/browse/IGNITE-3196?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15842927#comment-15842927 ]
ASF GitHub Bot commented on IGNITE-3196: ---------------------------------------- GitHub user daradurvs opened a pull request: https://github.com/apache/ignite/pull/1473 IGNITE-3196 We shouldn't check sign at serialization, because the used approach: BigInteger intVal = val.unscaledValue(); byte[] vals = intVal.toByteArray(); #toByteArray() - already including at least one sign bit, which is (ceil((this.bitLength() + 1)/8)). (This representation is compatible with the (byte[]) constructor.) Therefore, at deserialization we just read byte[] vals and scale, also we use default constructor which will define a sign from byte[] vals. You can merge this pull request into a Git repository by running: $ git pull https://github.com/daradurvs/ignite ignite-3196 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/ignite/pull/1473.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1473 ---- commit 48fab04f4a8b48a1f6ff0a632d56075c855b62e5 Author: daradurvs <daradu...@gmail.com> Date: 2017-01-26T17:21:01Z ignite-3196: serialization of BigDecimal is simplified commit 91327c3797fb1ea8702cf8e2ce34998819c0c8c9 Author: daradurvs <daradu...@gmail.com> Date: 2017-01-27T09:50:32Z ignite-3196: fix old serialization method (it is better, serialized object has the smaller size) commit f3d2297d9db4e773003eeea800ae37843ce79f14 Author: daradurvs <daradu...@gmail.com> Date: 2017-01-27T11:48:53Z ignite-3196: "negative scale with RoundingMode" tests are added ---- > Marshaling works wrong for the BigDecimals that have negative scale > ------------------------------------------------------------------- > > Key: IGNITE-3196 > URL: https://issues.apache.org/jira/browse/IGNITE-3196 > Project: Ignite > Issue Type: Bug > Components: binary > Affects Versions: 1.6 > Reporter: Igor Sapego > Assignee: Vyacheslav Daradur > Fix For: 2.0 > > > Current marshalling procedure of the {{BigDecimal}} assumes that the scale of > the {{BigDecimal}} value is always more than or equal to zero. However, scale > [can be > negative|https://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html#scale()]. > This leads to invalid results if we try to marshal-unmarshal {{BigDecimal}} > that has a negative scale. -- This message was sent by Atlassian JIRA (v6.3.4#6332)