static ExceptionInfo processStackTrace(StackTrace exception) {
    if (exception == null) {
      return null;
    }
    // Escape any special HTML characters in the exception that would otherwise break the HTML
    // rendering (e.g. the angle brackets around the default toString() for enums).
    String message = StringEscapeUtils.escapeHtml4(exception.toString());

    // Newline characters are usually stripped out by the parsing code in
    // {@link StackTrace#from(String)}, but they can sometimes remain (e.g. when the stack trace
    // is not in an expected format).  This replacement needs to be done after any HTML escaping.
    message = message.replace("\n", "<br/>");

    List<String> lines = exception.getElements()
        .stream()
        .map(element -> "&nbsp;&nbsp;&nbsp;&nbsp;at " + element.toString())
        .collect(toList());
    while (exception.getCause() != null) {
      exception = exception.getCause();
      String causeMessage = StringEscapeUtils.escapeHtml4(exception.toString());
      lines.add("Caused by: " + causeMessage.replace("\n", "<br/>"));
    }
    return new ExceptionInfo(message, lines);
  }
static ExceptionInfo processStackTrace ( StackTrace exception ) { if ( exception == null ) { return null ; } String message = StringEscapeUtils . escapeHtml4 ( exception . toString ( ) ) ; message = message . replace ( "\n" , "<br/>" ) ; List < String > lines = exception . getElements ( ) . stream ( ) . map ( element -> "&nbsp;&nbsp;&nbsp;&nbsp;at " + element . toString ( ) ) . collect ( toList ( ) ) ; while ( exception . getCause ( ) != null ) { exception = exception . getCause ( ) ; String causeMessage = StringEscapeUtils . escapeHtml4 ( exception . toString ( ) ) ; lines . add ( "Caused by: " + causeMessage . replace ( "\n" , "<br/>" ) ) ; } return new ExceptionInfo ( message , lines ) ; }
Parse the string representation of an exception to a {@link ExceptionInfo} instance.