コード例 #1
0
  @Override
  public String toString() {
    StringBuilder errorMessage = new StringBuilder();

    String message = getMessage();
    if (message != null) {
      errorMessage.append(message + "\n");
    }
    if (this.getCause() != null) {
      errorMessage.append("Caused by: " + getCause().getMessage() + "\n");
    }

    if (sourceFile != null) {
      errorMessage.append(
          "Exception thrown whilst attempting to process file:\n '"
              + sourceFile.getAbsolutePath()
              + "'.\n");
    }

    if (lineNumber >= 0) {
      errorMessage.append(" - line " + lineNumber + ", character " + characterNumber + ".\n");
    }

    if (message == null) {
      errorMessage.append("Stack trace:\n");
      StackTraceElement[] stackTrace = getStackTrace();
      for (StackTraceElement traceElement : stackTrace) {
        errorMessage.append("\t" + traceElement.toString() + "\n");
      }
    }

    return errorMessage.toString();
  }
コード例 #2
0
ファイル: NodeItemModelTester.java プロジェクト: Gogsl/brjs
  private void verifyTopDownItem(PN parentNode) throws Exception {
    Method getItemMethod = parentNodeClass.getMethod(itemMethodName);
    @SuppressWarnings("unchecked")
    CN childNode = (CN) getItemMethod.invoke(parentNode);

    assertEquals(childPath.getAbsolutePath(), childNode.dir().getPath());
  }