ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant BuildException.java
Date Sat, 03 Feb 2001 14:06:32 GMT
conor       01/02/03 06:06:32

  Modified:    src/main/org/apache/tools/ant BuildException.java
  Log:
  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>
  
  Revision  Changes    Path
  1.10      +29 -1     jakarta-ant/src/main/org/apache/tools/ant/BuildException.java
  
  Index: BuildException.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/BuildException.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- BuildException.java	2001/01/03 14:18:26	1.9
  +++ BuildException.java	2001/02/03 14:06:32	1.10
  @@ -1,7 +1,7 @@
   /*
    * 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.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -53,6 +53,9 @@
    */
   package org.apache.tools.ant;
   
  +
  +import java.io.*;
  +
   /**
    * Signals an error condition during a build.
    *
  @@ -161,5 +164,30 @@
        */
       public Location getLocation() {
           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);
  +            }
  +        }
       }
   }
  
  
  

Mime
View raw message