Might want to just remove the RuntimeException and use something a little
friendlier... Here's a good example:

import java.io.*;

public class Util {

  private Util() {}

  public static void main(String[] args) {
    System.out.println(trace());
  }

  public static String trace() {
    StringWriter writer = new StringWriter();
    new Tracer().printStackTrace(new PrintWriter(writer,true));
    return writer.toString();
  }

  private static class Tracer extends Throwable {
    public String toString() {
      return "*** Snapshot of Execution Stack ***";
    }
  }

}

Save that into Util.java, compile, and run. It makes output like:

*** Snapshot of Execution Stack ***
      at Util.trace(Util.java:13)
      at Util.main(Util.java:8)


David Green

On Thu, 28 Jun 2001 [EMAIL PROTECTED] wrote:

>   User: starksm
>   Date: 01/06/28 08:23:55
>
>   Modified:    tomcat/src/main/org/jboss/test/tomcat/ejb/bean
>                         StatelessSessionBean.java
>   Log:
>   Don't show the call stack trace unless trace is true.
>
>   Revision  Changes    Path
>   1.3       +1 -1      
>contrib/tomcat/src/main/org/jboss/test/tomcat/ejb/bean/StatelessSessionBean.java
>
>   Index: StatelessSessionBean.java
>   ===================================================================
>   RCS file: 
>/cvsroot/jboss/contrib/tomcat/src/main/org/jboss/test/tomcat/ejb/bean/StatelessSessionBean.java,v
>   retrieving revision 1.2
>   retrieving revision 1.3
>   diff -u -r1.2 -r1.3
>   --- StatelessSessionBean.java       2001/05/11 19:06:25     1.2
>   +++ StatelessSessionBean.java       2001/06/28 15:23:55     1.3
>   @@ -63,7 +63,7 @@
>            } while( loader != null );
>            // Write the call stack
>            buffer.append("+++ Call stack:\n");
>   -        Throwable t = new RuntimeException();
>   +        Throwable t = new Exception("Stack Trace");
>            StringWriter sw = new StringWriter();
>            PrintWriter pw = new PrintWriter(sw);
>            t.printStackTrace(pw);
>
>
>
>
> _______________________________________________
> Jboss-development mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-development
>


_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to