FULL PRODUCT VERSION :
1.7.0_147-icedtea if you use Long.parseLong
ADDITIONAL OS VERSION INFORMATION :
Linux knuffelchen 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:56:25 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
This bug encounters if you try to decode
Color.WHITE
code:
Color.decode("0x" + Color.White.getRgb()).
Integer.parseInt failed.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Try to run this statement:
Integer.parseInt("ffffffff", 16);
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
0xffffffff
ACTUAL -
java.lang.NumberFormatException: For input string: "ffffffff"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
@Test
public void testGetColour() {
Color.decode("0x" + Integer.toHexString(Color.WHITE.getRGB()));
}
@Test
public void testParseInt() {
Integer.parseInt(Integer.toHexString(0xffffffff), 16);
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Color decodeColor() {
return new Color(Long.decode("ffffffff", 16).intValue(), true);
}