Eu gostaria de exibir no stacktrace a lista de Detalhes que esta dentro da exception … como fazer ?
Estou usando o org.apache.commons.lang.exception.ExceptionUtils.getFullStackTrace(Throwable)
metodo1 throws Myexception1(“1”)
metodo2 throws Myexception1(“2”)
metodo3 throws Myexception1(“3”)
metodo4 throws Myexception1(“4”)
metodo1(){
metodo2()
//aqui eu obtenho a lista com detalhes
}
metodo2(){
metodo3()
}
metodo3(){
metodo4()
}
metodo4(){
Myexception m = new Myexception();
m.setDetalhes(lista-de-erros-personalizados);
throw new m;
}
Myexception1{
private List detalhes;
}
resolvido.
try {
List list = ExceptionUtils.getThrowableList(e);
for (Object object : list) {
IntegracaoException ie;
if (object instanceof IntegracaoException) {
ie = (IntegracaoException) object;
if (ie.getDetalhes() != null) {
List<String> detalhes = ie.getDetalhes();
for (String d : detalhes) {
b.append(d);
b.append("\n");
}
}
}
}
} catch (Exception e1) {