Une collection de méthodes utilitaires pour manipuler les exceptions

Author:


{filelink=4385}

import java.io.*;

public final class StringDansException {

  public static String obtenirLeStringDeStackTrace(Throwable t) {

    if (t != null) {
      StringWriter sw = new StringWriter();
      PrintWriter writer = new PrintWriter(sw);
      t.printStackTrace(writer);
      return sw.getBuffer().toString();
    } else {
      return "";
    }
  }

}

Leave a Reply

Your email address will not be published. Required fields are marked *