// This is where it was suppose to forward to in the first place.
ActionForward forward = super.execute(ex, ae, mapping, form, request, response);
ServletContext sCtx = request.getSession().getServletContext();
WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(sCtx);
IErrorLogService loggerService = (IErrorLogService) wac.getBean(BaseConstants.SERVICE_ERRORLOGGER_LOOKUP);
String forwardKey = new String();
Integer statusCode = (Integer) request.getAttribute("javax.servlet.error.status_code");
Throwable thr = (Throwable)request.getAttribute("javax.servlet.error.exception");
StringBuffer strBuffer = new StringBuffer();
if (thr != null){
StackTraceElement[] stack = thr.getStackTrace();
for(int n = 0; n < stack.length; n++) {
strBuffer.append(stack[n].toString());
strBuffer.append("\n");
}
}
//String messg = (String) request.getAttribute("javax.servlet.error.message");
String messg = (String) ex.getMessage();
messg = (messg != null && messg.length() >= 4000) ? messg.substring(0,3999) : messg;
String trace = strBuffer.toString();
trace = (trace != null && trace.length() >= 4000) ? trace.substring(0,3999) : trace;
//String cause = (String) request.getAttribute("javax.servlet.error.request_uri");
String cause = new String();
if (ex.getCause() != null)
cause = ex.getCause().toString();
String userName = new String();
try {
MyAlumniUserContainer sessionObj = null;
HttpSession session = request.getSession(false);
if (session != null) {
sessionObj = (MyAlumniUserContainer) session.getAttribute(BaseConstants.USER_CONTAINER);
userName = sessionObj.getToken().getMemberUserName();
}
} catch (Exception npe) {
// do nothing
userName = "";
}
ErrorLogVO errorLog = new ErrorLogVO();
errorLog.setErrorDate(new Date());
errorLog.setLoggedBy(userName);
errorLog.setLastModifiedBy(userName);
errorLog.setErrorMessage(messg);
errorLog.setCause(cause);
errorLog.setTrace(trace);
loggerService.addErrorLog(errorLog);
// 700: Insufficient Priviledges
// 701: Session Timed Out