if (ite != null && ite.getTargetException() instanceof AssumptionViolatedException) {
throw new AssumptionViolatedException(ite.getTargetException().getMessage());
}
XString causes = new XString("%s (Original Exception %s not serializable. Resolving chain"
, t.getMessage()
, t.getClass().getName());
Throwable tChain = t;
// Use cause (if possible / serializable)
if (ite != null) {
causes.addLineFormatted("%s [Target: %s]", ite.getMessage(), ite.getTargetException());
if (ite.getTargetException() != null) {
tChain = ite.getTargetException();
}
}
Throwable cause = tChain.getCause();
while (cause != null) {
if (!IOUtil.isSerializable(cause)) {
causes.addLineFormatted("%s [Caused by: %s (non-serializable)", cause.getMessage(), cause.getClass().getName());
cause = cause.getCause();
} else {
break;
}
}
if (cause != null) {
throw new JuRuntimeException(causes.toString(), cause);
} else {
causes.addLine("Check Server log for more details");
throw new JuRuntimeException(causes.toString());
}
} else {
throw t;
}
}