X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.util%2Fsrc%2Forg%2Fargeo%2Futil%2FExceptionsChain.java;fp=org.argeo.util%2Fsrc%2Forg%2Fargeo%2Futil%2FExceptionsChain.java;h=0000000000000000000000000000000000000000;hb=15e4462e165655e355a8286a70dae562a120bc1d;hp=773a1b733c7cfbb04a7726cf68d5961d502182af;hpb=a940a66aca249a1ce7dea66d43b0e2816845d7d1;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.util/src/org/argeo/util/ExceptionsChain.java b/org.argeo.util/src/org/argeo/util/ExceptionsChain.java deleted file mode 100644 index 773a1b733..000000000 --- a/org.argeo.util/src/org/argeo/util/ExceptionsChain.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.argeo.util; - -import java.util.ArrayList; -import java.util.List; - -/** Serialisable wrapper of a {@link Throwable}. */ -public class ExceptionsChain { - private List exceptions = new ArrayList<>(); - - public ExceptionsChain() { - } - - public ExceptionsChain(Throwable exception) { - writeException(exception); - } - - /** recursive */ - protected void writeException(Throwable exception) { - SystemException systemException = new SystemException(exception); - exceptions.add(systemException); - Throwable cause = exception.getCause(); - if (cause != null) - writeException(cause); - } - - public List getExceptions() { - return exceptions; - } - - public void setExceptions(List exceptions) { - this.exceptions = exceptions; - } - - /** An exception in the chain. */ - public static class SystemException { - private String type; - private String message; - private List stackTrace; - - public SystemException() { - } - - public SystemException(Throwable exception) { - this.type = exception.getClass().getName(); - this.message = exception.getMessage(); - this.stackTrace = new ArrayList<>(); - StackTraceElement[] elems = exception.getStackTrace(); - for (int i = 0; i < elems.length; i++) - stackTrace.add("at " + elems[i].toString()); - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public List getStackTrace() { - return stackTrace; - } - - public void setStackTrace(List stackTrace) { - this.stackTrace = stackTrace; - } - - @Override - public String toString() { - return "System exception: " + type + ", " + message + ", " + stackTrace; - } - - } - - @Override - public String toString() { - return exceptions.toString(); - } -}