Clojure

Misleading ClassCastException when coercing a String to int

Details

  • Type: Enhancement Enhancement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: Release 1.4
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Patch:
    Code and Test

Description

Observed behaviour

(int "0") =>
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Character

Expected behaviour
(int "0") =>
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
or 
IllegalArgumentException

Activity

Stuart Halloway made changes -
Field Original Value New Value
Issue Type Defect [ 1 ] Enhancement [ 4 ]
Michael Drogalis made changes -
Michael Drogalis made changes -
Patch Code and Test [ 10002 ]
Alex Miller made changes -
Description Observed behaviour

(int "0") =>
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Character

Expected behaviour
(int "0") =>
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
or
IllegalArgumentException
Observed behaviour

{code}
(int "0") =>
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Character

Expected behaviour
(int "0") =>
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
or
IllegalArgumentException
{code}
Labels bug
Alex Miller made changes -
Labels errormsgs
Michael Drogalis made changes -
Attachment string-coerce-to-int.diff [ 12233 ]

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated: