Browse Source

Change buildException to always print nested exceptions when printing

its stack trace. Removed the equivalent code from DefaultLogger.

Submitted by:	Jesse Glick <Jesse.Glick@netbeans.com>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268565 13f79535-47bb-0310-9956-ffa450edef68
master
Conor MacNeill 24 years ago
parent
commit
04024a63d1
1 changed files with 29 additions and 1 deletions
  1. +29
    -1
      src/main/org/apache/tools/ant/BuildException.java

+ 29
- 1
src/main/org/apache/tools/ant/BuildException.java View File

@@ -1,7 +1,7 @@
/* /*
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
* *
* Copyright (c) 1999 The Apache Software Foundation. All rights
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* reserved. * reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -53,6 +53,9 @@
*/ */
package org.apache.tools.ant; package org.apache.tools.ant;



import java.io.*;

/** /**
* Signals an error condition during a build. * Signals an error condition during a build.
* *
@@ -162,4 +165,29 @@ public class BuildException extends RuntimeException {
public Location getLocation() { public Location getLocation() {
return location; return location;
} }

// Override stack trace methods to show original cause:
public void printStackTrace() {
printStackTrace(System.err);
}
public void printStackTrace(PrintStream ps) {
synchronized (ps) {
ps.println(this);
if (cause != null) {
ps.println("--- Nested Exception ---");
cause.printStackTrace(ps);
}
}
}
public void printStackTrace(PrintWriter pw) {
synchronized (pw) {
pw.println(this);
if (cause != null) {
pw.println("--- Nested Exception ---");
cause.printStackTrace(pw);
}
}
}
} }

Loading…
Cancel
Save