Clojure

Error reporting of invalid digit in unicode character literal

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor 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); 

Activity

Cosmin Stejerean made changes -
Field Original Value New Value
Attachment CLJ-924-unicode-invalid-digit.patch [ 10890 ]
Cosmin Stejerean made changes -
Patch Code [ 10001 ]
Stuart Sierra made changes -
Approval Screened [ 10004 ]
Andy Fingerhut made changes -
Rich Hickey made changes -
Approval Screened [ 10004 ] Ok [ 10007 ]
Affects Version/s Release 1.4 [ 10040 ]
Fix Version/s Release 1.4 [ 10040 ]
Stuart Halloway made changes -
Resolution Completed [ 1 ]
Status Open [ 1 ] Closed [ 6 ]

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: