/** * Creates and returns HTML representing the details of this incident info. This method is only * called if the details needs to be generated: ie: the detailed error message property of the * incident info is null. */ protected String getDetailsAsHTML(ErrorInfo errorInfo) { if (errorInfo.getErrorException() != null) { // convert the stacktrace into a more pleasent bit of HTML StringBuffer html = new StringBuffer("<html>"); html.append("<h2>" + escapeXml(errorInfo.getTitle()) + "</h2>"); html.append("<HR size='1' noshade>"); html.append("<div></div>"); html.append("<b>Message:</b>"); html.append("<pre>"); html.append(" " + escapeXml(errorInfo.getErrorException().toString())); html.append("</pre>"); html.append("<b>Level:</b>"); html.append("<pre>"); html.append(" " + errorInfo.getErrorLevel()); html.append("</pre>"); html.append("<b>Stack Trace:</b>"); Throwable ex = errorInfo.getErrorException(); while (ex != null) { html.append("<h4>" + ex.getMessage() + "</h4>"); html.append("<pre>"); for (StackTraceElement el : ex.getStackTrace()) { html.append(" " + el.toString().replace("<init>", "<init>") + "\n"); } html.append("</pre>"); ex = ex.getCause(); } html.append("</html>"); return html.toString(); } else { return null; } }