1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kns.web.struts.form.pojo;
17
18 import org.apache.log4j.Logger;
19 import org.apache.struts.action.ActionForm;
20 import org.apache.struts.action.ActionForward;
21 import org.apache.struts.action.ActionMapping;
22 import org.apache.struts.action.ExceptionHandler;
23 import org.apache.struts.config.ExceptionConfig;
24 import org.kuali.rice.kns.web.struts.form.KualiDocumentFormBase;
25 import org.kuali.rice.kns.util.IncidentReportUtils;
26
27 import javax.servlet.http.HttpServletRequest;
28 import javax.servlet.http.HttpServletResponse;
29 import java.util.Map;
30
31
32
33
34
35
36
37
38
39 @Deprecated
40 public class StrutsExceptionIncidentHandler extends ExceptionHandler {
41 private static final Logger LOG=
42 Logger.getLogger(StrutsExceptionIncidentHandler.class);
43
44
45
46
47
48
49 public static final String EXCEPTION_INCIDENT_HANDLER="exceptionIncidentHandler";
50
51
52
53
54
55
56
57
58
59
60
61
62
63 public ActionForward execute(Exception exception,
64 ExceptionConfig exceptionConfig,
65 ActionMapping mapping,
66 ActionForm form,
67 HttpServletRequest request,
68 HttpServletResponse response) {
69
70 if (LOG.isTraceEnabled()) {
71 String message=String.format("ENTRY %s", exception.getMessage());
72 LOG.trace(message);
73 }
74
75 LOG.error("Exception being handled by Exception Handler", exception);
76
77 String documentId="";
78 if (form instanceof KualiDocumentFormBase) {
79 KualiDocumentFormBase docForm=(KualiDocumentFormBase)form;
80 if (docForm.getDocument() != null) {
81 documentId=docForm.getDocument().getDocumentNumber();
82 }
83 }
84
85 Map<String, String> properties = IncidentReportUtils.populateRequestForIncidentReport(exception, documentId, form.getClass().getSimpleName(), request);
86
87 ActionForward forward=mapping.findForward(EXCEPTION_INCIDENT_HANDLER);
88
89 if (LOG.isTraceEnabled()) {
90 String message=String.format("ENTRY %s%n%s%n%s",
91 exception.getMessage(),
92 properties.toString(),
93 (forward==null)?"null":forward.getPath());
94 LOG.trace(message);
95 }
96
97 return forward;
98 }
99
100 }
101