/*
 * Created on Jan 7, 2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package gov.va.med.esr.ui.util;

import gov.va.med.esr.ui.ApplicationConstants;

import org.apache.struts.action.*;

import javax.servlet.*;
import javax.servlet.http.*;

import org.apache.struts.config.*;

/**
 * @author DNS   RAMACP
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
/**
 * @author DNS   RAMACP
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class RuntimeExceptionHandler extends ExceptionHandler {

	
	
	/** 
	 * @see org.apache.struts.action.ExceptionHandler#execute(java.lang.Exception, org.apache.struts.config.ExceptionConfig, org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
	 */
	public ActionForward execute(
            Exception ex,
            ExceptionConfig ae,
            ActionMapping mapping,
            ActionForm formInstance,
            HttpServletRequest request,
            HttpServletResponse response)
	 		throws ServletException 
	{

//	 	TODO: need to log the exception
	 	//if( log.isInfoEnabled() ) {
		//      log.info( e.getMessage() );
		//} 
	 	//ex.printStackTrace();
		
		logException(ex);
	 	
		HttpSession session = request.getSession();
		session.setAttribute(ApplicationConstants.SessionData.EXCEPTION,ex);
		
	 	return new ActionForward(mapping.findForward("error"));
	 }

}
