From: Studying the evolution of exception handling anti-patterns in a long-lived large-scale project
//Example of Destructive Wrapping | |
try { | |
if(con != null) con.close(); | |
} catch (SQLException e) { | |
throw new DataException(e.getMessage()); | |
//Example of Catch Generic | |
try { | |
cal = CalendarHelper.getCalendar(getCurrentUser()); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
defaultHandle(e); | |
//Example of Throws Generic | |
public Object method(HttpServletRequest req) | |
throws Exception { | |
GenericDataAccess dao = getGeneric(); | |
Object obj = getCommandClass().newInstance(); | |
//.... | |
return obj; |