Java : Error handling: generic exception