} else {
logger.error("handleException: ", exception);
}
ErrorPage finalizeRef = null;
try {
final ErrorPage errorPage = createErrorPage(pageClass, exception);
finalizeRef = errorPage;
errorPage.setError(exception);
if (errorPage.getFormat() == null) {
errorPage.setFormat(configService.createFormat());
}
errorPage.setHeaders(configService.getPageHeaders(ConfigService.ERROR_PATH));
errorPage.setMode(configService.getApplicationMode());
errorPage.setPageClass(pageClass);
errorPage.setPath(ConfigService.ERROR_PATH);
processPageFields(errorPage, new FieldCallback() {
public void processField(String fieldName, Object fieldValue) {
if (fieldValue instanceof Control) {
Control control = (Control) fieldValue;
if (control.getName() == null) {
control.setName(fieldName);
}
if (!errorPage.getModel().containsKey(control.getName())) {
errorPage.addControl(control);
}
}
}
});
if (errorPage.isStateful()) {
synchronized (errorPage) {
processPage(errorPage);
processPageOnDestroy(errorPage, 0);
// Mark page as already destroyed for finally block
finalizeRef = null;