KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > jwebunit > util > ExceptionUtility


1 /********************************************************************************
2  * Copyright (c) 2001, ThoughtWorks, Inc.
3  * Distributed open-source, see full license under licenses/jwebunit_license.txt
4 **********************************/

5 package net.sourceforge.jwebunit.util;
6
7 import java.io.StringWriter JavaDoc;
8 import java.io.PrintWriter JavaDoc;
9
10 /**
11  * Utility to get stack trace as string from an exception.
12  *
13  * @author Wilkes Joiner
14  */

15 public class ExceptionUtility {
16     public static String JavaDoc stackTraceToString(Throwable JavaDoc t){
17         StringWriter JavaDoc sw = new StringWriter JavaDoc();
18         t.printStackTrace(new PrintWriter JavaDoc(sw));
19         return sw.toString();
20     }
21 }
22
Popular Tags