Package org.sakaiproject.portal.util
Class ErrorReporter
- java.lang.Object
-
- org.sakaiproject.portal.util.ErrorReporter
-
public class ErrorReporter extends Object
ErrorReporter helps with end-user formatted error reporting, user feedback collection, logging and emailing for uncaught throwable based errors. This is a util class as it's used by both the CharronPortal and the SkinnableCharronPortal.
-
-
Constructor Summary
Constructors Constructor Description ErrorReporter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StringcomputeSha1(String content)protected ThrowablegetCause(Throwable t)Compute the cause of a throwable, checking for the special ServletException case, and the points-to-self case.protected StringgetOneTrace(Throwable t)Format a one-level stack trace, just showing the place where the exception occurred (the first entry in the stack trace).protected StringgetStackTrace(Throwable t)Format the full stack trace.protected voidlogAndMail(String bugId, String usageSessionId, String userId, String time, String problem, String problemdigest, String requestURI, String userReport)Logger and email the error report details.protected voidlogAndMail(String bugId, String usageSessionId, String userId, String time, String problem, String problemdigest, String requestURI, String requestDisplay, String placementDisplay, String userReport)voidpostResponse(HttpServletRequest req, HttpServletResponse res)Accept the user feedback post.voidreport(HttpServletRequest req, HttpServletResponse res, Throwable t)Handle the inital report of an error, from an uncaught throwable, with a user display.voidreport(HttpServletRequest req, HttpServletResponse res, Throwable t, boolean fullPage)StringreportFragment(HttpServletRequest req, HttpServletResponse res, Throwable t)Handle the inital report of an error, from an uncaught throwable, with a user display - but returning a string that contins a fragment.voidthanksResponse(HttpServletRequest req, HttpServletResponse res)Accept the user feedback post.protected StringthrowableDisplay(Throwable t)Format a throwable for display: list the various throwables drilling down the cause, and full stacktrack for the final cause.
-
-
-
Method Detail
-
getStackTrace
protected String getStackTrace(Throwable t)
Format the full stack trace.- Parameters:
t- The throwable.- Returns:
- A display of the full stack trace for the throwable.
-
getOneTrace
protected String getOneTrace(Throwable t)
Format a one-level stack trace, just showing the place where the exception occurred (the first entry in the stack trace).- Parameters:
t- The throwable.- Returns:
- A display of the first stack trace entry for the throwable.
-
getCause
protected Throwable getCause(Throwable t)
Compute the cause of a throwable, checking for the special ServletException case, and the points-to-self case.- Parameters:
t- The throwable.- Returns:
- The cause of the throwable, or null if there is none.
-
throwableDisplay
protected String throwableDisplay(Throwable t)
Format a throwable for display: list the various throwables drilling down the cause, and full stacktrack for the final cause.- Parameters:
t- The throwable.- Returns:
- The string display of the throwable.
-
logAndMail
protected void logAndMail(String bugId, String usageSessionId, String userId, String time, String problem, String problemdigest, String requestURI, String userReport)
Logger and email the error report details.- Parameters:
usageSessionId- The end-user's usage session id.userId- The end-user's user id.time- The time of the error.problem- The stacktrace of the error.problemdigest- The sha1 digest of the stacktrace.requestURI- The request URI.userReport- The end user comments.object-placementDisplay-
-
logAndMail
protected void logAndMail(String bugId, String usageSessionId, String userId, String time, String problem, String problemdigest, String requestURI, String requestDisplay, String placementDisplay, String userReport)
-
reportFragment
public String reportFragment(HttpServletRequest req, HttpServletResponse res, Throwable t)
Handle the inital report of an error, from an uncaught throwable, with a user display - but returning a string that contins a fragment.- Parameters:
req- The request.res- The response.t- The uncaught throwable.
-
report
public void report(HttpServletRequest req, HttpServletResponse res, Throwable t)
Handle the inital report of an error, from an uncaught throwable, with a user display.- Parameters:
req- The request.res- The response.t- The uncaught throwable.
-
report
public void report(HttpServletRequest req, HttpServletResponse res, Throwable t, boolean fullPage)
-
postResponse
public void postResponse(HttpServletRequest req, HttpServletResponse res)
Accept the user feedback post.- Parameters:
req- The request.res- The response.
-
thanksResponse
public void thanksResponse(HttpServletRequest req, HttpServletResponse res)
Accept the user feedback post.- Parameters:
req- The request.res- The response.
-
-