Using old-style catch block for compatibility with older JDK.