Details
-
Type:
Defect
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Completed
-
Affects Version/s: Release 1.2, Release 1.3
-
Fix Version/s: Release 1.4
-
Component/s: None
-
Labels:None
-
Patch:Code
-
Approval:Ok
Description
I ran across the following code when reading unicode character literals in readUnicodeChar(String token, int offset, int length, int base)
int d = Character.digit(token.charAt(i), base);
if(d == -1)
throw new IllegalArgumentException("Invalid digit: " + (char) d);
Casting -1 to a char doesn't seem to produce anything useful. I'm guessing the appropriate code might look like
int d = Character.digit(token.charAt(i), base);
if(d == -1)
throw new IllegalArgumentException("Invalid digit: " + token.charAt(i));
For comparison, the code in the other readUnicodeCharacter used when reading strings handles this correctly with:
int d = Character.digit(ch, base);
if(d == -1)
throw new IllegalArgumentException("Invalid digit: " + (char) ch);
Attached a patch with the minor code fix.