/*
 * Created on 02-Feb-2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package uk.ac.roe.wfau;

import java.io.PrintWriter;
import java.io.StringWriter;

/**
 * gets a string from a stacktrace
 * @author mar
 * 
 *
 */


public class stack2string {

    /**
     * gets a string from a stacktrace
     * @param e exception
     * @return string of stacktrace
     */
    static public String getString(Exception e) {
        try {
          StringWriter sw = new StringWriter();
          PrintWriter pw = new PrintWriter(sw);
          e.printStackTrace(pw);
          return "------\r\n" + sw.toString() + "------\r\n";
          }
        catch(Exception e2) {
          return "bad stack2string";
          }
        } 
      }
