}
// fetch more info
// get the latest window which caused this exception
String componentListenerInfo = "";
Windows ws = Windows.getWindows(ureq);
Window window = ws.getWindow(ureq);
if (window != null) {
Component target = window.getAndClearLatestDispatchedComponent();
if (target != null) {
// there was a component id given, and a matching target could be found
componentListenerInfo = "<dispatchinfo>\n\t<componentinfo>\n\t\t<compname>" + target.getComponentName() + "</compname>\n\t\t<compclass>"
+ target.getClass().getName() + "</compclass>\n\t\t<extendedinfo>" + target.getExtendedDebugInfo()
+ "</extendedinfo>\n\t\t<event>";
Event latestEv = target.getAndClearLatestFiredEvent();
if (latestEv != null) {
componentListenerInfo += "\n\t\t\t<class>"+latestEv.getClass().getName()+"</class>\n\t\t\t<command>"+latestEv.getCommand()+"</command>\n\t\t\t<tostring>"+latestEv+"</tostring>";
}
componentListenerInfo += "\n\t\t</event>\n\t</componentinfo>\n\t<controllerinfo>";
Controller c = target.getLatestDispatchedController();
if (c != null) {
// can be null if the error occured in the component itself
// componentListenerInfo += c.toString();
//WindowControl control = c.getWindowControl();
// sorry, getting windowcontrol on a controller which does not have one (all should have one, legacy) throws an exception
try {
WindowControlInfo wci = c.getWindowControlForDebug().getWindowControlInfo();
while (wci != null) {
String cName = wci.getControllerClassName();
componentListenerInfo += "\n\t\t<controllername>" + cName + "</controllername>";
wci = wci.getParentWindowControlInfo();
}
} catch (Exception e) {
componentListenerInfo += "no info, probably no windowcontrol set: "+e.getClass().getName()+", "+e.getMessage();
}
}
componentListenerInfo += "\n\t</controllerinfo>\n</dispatchinfo>";
}
}
if(o3e instanceof KnownIssueException){
KnownIssueException kie = (KnownIssueException)o3e;
msg.contextPut("knownissuelink", kie.getJiraLink());
}
// TODO: DB.getInstance().hasTransaction() TODO: log db transaction id if in
// transaction
long refNum = Tracing.logError("**RedScreen** "+o3e.getLogMsg() + " ::_::" + componentListenerInfo + " ::_::", o3e, o3e.getThrowingClazz());
// only if debug
if (Settings.isDebuging()) {
msg.contextPut("debug", Boolean.TRUE);
} else {
msg.contextPut("debug", Boolean.FALSE);
}
msg.contextPut("listenerInfo", Formatter.escWithBR(componentListenerInfo).toString());
msg.contextPut("stacktrace", OLATRuntimeException.throwableToHtml(th));
Identity curIdent = ureq.getIdentity();
msg.contextPut("username", curIdent == null? "n/a" : curIdent.getName());
msg.contextPut("allowBackButton", Boolean.valueOf(allowBackButton));
msg.contextPut("detailedmessage", detailedmessage);
// Cluster NodeId + E-Nr
msg.contextPut("errnum", "N" + CoordinatorManager.getCoordinator().getNodeId() + "-E"+ refNum);
msg.contextPut("supportaddress", WebappHelper.getMailConfig("mailSupport"));
msg.contextPut("time", formatter.formatDateAndTime(new Date()));
WindowBackOffice wbo = ws.getWindowManager().createWindowBackOffice("errormessagewindow", this);
Window w = wbo.getWindow();
msg.put("jsCssRawHtmlHeader", w.getJsCssRawHtmlHeader());
// the current GUI theme and the global settings that contains the
// font-size. both are pushed as objects so that window.dirty always reads
// out the correct value
msg.contextPut("theme", w.getGuiTheme());
msg.contextPut("globalSettings", ws.getWindowManager().getGlobalSettings());
w.setContentPane(msg);
setWindow(w);
}