Example #1
0
  // TODO not finished and used yet
  public FullStackTrace getFullStackTrace() {
    StringBuilder sb = new StringBuilder();
    String ls = System.lineSeparator();

    sb.append(time)
        .append(" ")
        .append(level)
        .append(" (")
        .append(clazz.getFullyQualifiedName())
        .append(")")
        .append(" ")
        .append(message)
        .append(ls);

    for (CausedBy causedBy : causedBies) {

      if (causedBy.getExceptionClazz() != null) {
        causedBy.appendReferenceRepresentation(sb);
        sb.append(ls);
      }

      for (AtLine atLine : causedBy.getAtLines()) {
        sb.append("\tat ").append(atLine.getReferenceRepresentation()).append(ls);
      }
    }

    String stackTrace = sb.toString();
    int numberOfLines = stackTrace.split(ls).length;

    return new FullStackTrace(stackTrace, numberOfLines);
  }
  @Test
  public void parseAtLine() {
    AtLine atLine = lineParser.parseAtLine(AT_LINE);

    assertNotNull(atLine);
    assertEquals(new Clazz("org.apache.catalina.core.ApplicationFilterChain"), atLine.getClazz());
    assertEquals("doFilter", atLine.getMethod());
    assertEquals("ApplicationFilterChain.java:206", atLine.getSource());
  }