History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: XSTR-382
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Assignee: Unassigned
Reporter: Nicolas Gros d'Aillon
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
XStream

hexadecimal and octal unsigned number values parsing

Created: 05/Mar/07 12:33 PM   Updated: 24/May/07 12:38 AM
Component/s: None
Affects Version/s: None
Fix Version/s: 1.2.2

File Attachments: 1. File xstream-unsigned-number.diff (3 kb)



 Description  « Hide
The standard sun JDK doesn't handle the parsing of negative in hexadecimal or octal if there is not a minus sing in front. In this case, we can't parse 0xFFFF as a short with the value -1, the -0x1value must be used.
It seems that eventif in febuary 1999 someone complained about the problem with Integer.valueOf(Integer.toHexString(-1), 16), none of the java version 1.4, 1.5 and event 1.6 can handle unsigned values while parsing strings. The most effective way to parse the numbers would be to completly reimplement the decode()/valueOf()/parseXXX() of the numeric types, but I just used some work-around by using a bigger type of number (except for long).


 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Joerg Schaible - 05/Mar/07 02:50 PM
Thanks for the patch, applied.