import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;
public class Exemple {
public static final String stackTrace(Throwable e)
{
String excep = null;
try
{
ByteArrayOutputStream ostr = new ByteArrayOutputStream();
e.printStackTrace( new PrintWriter(ostr,true) );
excep = ostr.toString(); //Utilisation de la méthode toString()
}
catch (Exception ex)
{
System.out.println("Rien à faire ici");
}
return excep;
}
}