//TODO remove the below warn again once OLAT-5715 has been resolved - or it turns out that below warn is too verbose
// the idea is that at this stage the throwable still contains a stacktrace but passed into the OLATRuntimeException
// below as the cause it somehow gets lost. If this does not turn out to be true then the line below can be removed.
// in any case, it is just a log.warn
Tracing.logWarn("ExceptionWindowController<init>: Throwable occurred, logging the full stacktrace:", th, getClass());
Translator trans = new PackageTranslator(PACKAGE, ureq.getLocale());
Formatter formatter = Formatter.getInstance(ureq.getLocale());
msg = new VelocityContainer("olatmain", VELOCITY_ROOT + "/exception_page.html", trans, this);
// disallow wrapping of divs around the panel and the main velocity page
// (since it contains the "<html><head... intro of the html page,
// and thus has better to be replaced as a whole (new page load) instead of
// a dom replacement)
msg.setDomReplaceable(false);
Version v = (Version) CoreSpringFactory.getBean("org.olat.core.Version");
msg.contextPut("buildversion", v.getVersion());
OLATRuntimeException o3e;
if (th == null){
o3e = new OLATRuntimeException("Error Screen with a Throwable == null", null);
} else if (!(th instanceof OLATRuntimeException)) {
o3e = new OLATRuntimeException(th.getMessage(), th);
} else {
o3e = (OLATRuntimeException) th;
}
String detailedmessage = null;
// translate user message if available
if (o3e.getUsrMsgKey() != null && o3e.getUsrMsgPackage() != null) {
PackageTranslator usrMsgTrans = new PackageTranslator(o3e.getUsrMsgPackage(), ureq.getLocale());
if (o3e.getUsrMsgArgs() == null) {
detailedmessage = usrMsgTrans.translate(o3e.getUsrMsgKey());
} else {
detailedmessage = usrMsgTrans.translate(o3e.getUsrMsgKey(), o3e.getUsrMsgArgs());
}
}
// fix detailed message
if (detailedmessage == null) {
if (o3e instanceof StaleObjectRuntimeException) {
StaleObjectRuntimeException soe = (StaleObjectRuntimeException) o3e;
detailedmessage = trans.translate("error.staleobjectexception") + "<br />(" + soe.getKey() + " : " + soe.getPersClassName() + ")";
}
else detailedmessage = "-";
}
// fetch more info