01: /* Copyright 2004 Inderjeet Singh. All rights reserved. You may not modify,
02: * use, reproduce or distribute this software except in compliance with the
03: * terms of the license at http://tcpmon.dev.java.net/
04: * $Id: Utils.java,v 1.2 2004/11/09 20:32:15 inder Exp $ */
05:
06: package tcpmon;
07:
08: import java.io.*;
09:
10: /**
11: * Generic utilities
12: * @author Inderjeet Singh
13: */
14: public class Utils {
15:
16: public static String extractStackTrace(Exception e) {
17: ByteArrayOutputStream stackTrace = new ByteArrayOutputStream();
18: PrintStream ps = new PrintStream(stackTrace);
19: ps.println("Received Exception: " + e.getMessage());
20: e.printStackTrace(new PrintStream(stackTrace));
21: return stackTrace.toString();
22: }
23: }
|