private ThrowableProxy(final Throwable throwable, final Set<Throwable> visited) {
this.throwable = throwable;
this.name = throwable.getClass().getName();
this.message = throwable.getMessage();
this.localizedMessage = throwable.getLocalizedMessage();
Stack<Class<?>> stack;
try {
Class<?>[] classCtx = (Class<?>[]) classContextMethod.invoke(throwable);
stack = new Stack<Class<?>>();
stack.addAll(Arrays.asList(classCtx));
} catch (Exception e) {
stack = StackLocatorUtil.getCurrentStackTrace();
}
final Map<String, CacheEntry> map = new HashMap<>();
this.extendedStackTrace = this.toExtendedStackTrace(stack, map, null, throwable.getStackTrace());
final Throwable throwableCause = throwable.getCause();
final Set<Throwable> causeVisited = new HashSet<>(1);
this.causeProxy = throwableCause == null ? null : new ThrowableProxy(throwable, stack, map, throwableCause,
visited, causeVisited);
this.suppressedProxies = this.toSuppressedProxies(throwable, visited);
}