FYI replying via email makes an unreadable mess in the web interface.

Not casting doesn't mean you cannot recognize an error condition. It means "ClassCastException" is not the right way to signal the error condition.