Bug #2360
Long types are not serialized correctly.
Status: | Resolved | Start date: | 08/13/2015 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | - | % Done: | 100% | |
Category: | Java | |||
Target version: | rsb-0.14 |
Description
A bug in the LongConverter.java file causes variables of type Long to be serialized and thereby be transmitted incorrectly.
The error is in this code snipped:
[...] (MASK << (i * BYTE_LENGTH)) [...]
Because MASK is of type int, the shift can cause unwanted results.
A quick fix could be to change MASK to type long, but the proposed solution in the patch file additionally reduces the number of operations and shortens the line of code.
Associated revisions
Fixed LongConverter in rsb-java/src/main/java/rsb/converter/LongConverter.java
fixes #2360
- rsb-java/src/main/java/rsb/converter/LongConverter.java
(LongConverter::serialize): handle large value correctly - rsb-java/src/test/java/rsb/converter/LongConverterTest.java
(LongConverterTest::roundtripLargeValue): test 6172840431323434035L in
addition to 130236144L
Reported-by: Benjamin Errouane <berrouane@techfak.uni-bielefeld.de>
Patch-by: Benjamin Errouane <berrouane@techfak.uni-bielefeld.de>
History
#1 Updated by J. Moringen over 8 years ago
- Status changed from New to In Progress
- Target version set to rsb-0.13
Thanks for the patch. Please extend it such that the unit tests fail without the correction.
#2 Updated by B. Errouane over 8 years ago
- File longConverterWithTest.patch added
Added the test changes to the patch.
#3 Updated by J. Moringen about 8 years ago
- Target version changed from rsb-0.13 to rsb-0.14
#4 Updated by J. Moringen almost 8 years ago
- Status changed from In Progress to Resolved
- % Done changed from 0 to 100
Applied in changeset rsb-java|a4ca315e6200b6d991cef945ae7b9b77b3656656.