Remove unnecessary casting.
Merge pull request #2630 from jburel/cast-exception

Cast exception