Add JavaException interface and make ResultHandler generic