http://www.javaworld.com/javaworld/jw-07-2005/jw-0711-exception.html?page=1
http://today.java.net/pub/a/today/2006/04/06/exception-handling-antipatterns.html
//////////////////////////////////////////////////////////////////////////////
public UserUI{
public User getUserUI() throws EJBException {
try{
UserBO userBo = new UserBO();
return UserBO.getUserBO();
}
}catch(AppException appEx){
if(appEx.isLogged)
logger.error(appEx)
throw new EJBException("EJB Exception" + app.getMessage())
}
}catch(Exception ex){
logger.error(ex)
throw new EJBException("Unknown system error");
}
}
}
//////////////////////////////////////////////////////////////////////////////
public UserBO{
public User getUserBO() throws AppException{
try{
UserDao userDao = new UserDao();
return userDao.getUserDao();
}catch(AppDBException ex){
if (!ex.isLogged)
logger.error(ex)
throw new AppException("System database error", true)
}catch(XMLException xmlEx){
logger.error(xmlEx)
throw new AppException("System XML error", true)
}
}
}
//////////////////////////////////////////////////////////////////////////////
public UserDAO{
public User getUserDao() throws AppDBException
{
try{
...
return User;
}catch(Exception ex){
logger.error(ex)
throw AppDBException("System database error", true)
}
}
}
//////////////////////////////////////////////////////////////////////////////
Friday, October 29, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment