WW-4674 Uses the same logic as in Dispatcher to control handling exception

This commit is contained in:
Lukasz Lenart
2016-09-16 16:31:17 +02:00
parent 45c113eaa9
commit 459e198022
2 changed files with 12 additions and 2 deletions
@@ -216,7 +216,11 @@ public class Dispatcher {
*/
@Inject(StrutsConstants.STRUTS_DEVMODE)
public void setDevMode(String mode) {
devMode = "true".equals(mode);
devMode = Boolean.parseBoolean(mode);
}
public boolean isDevMode() {
return devMode;
}
/**
@@ -270,6 +274,10 @@ public class Dispatcher {
this.handleException = Boolean.parseBoolean(handleException);
}
public boolean isHandleException() {
return handleException;
}
@Inject
public void setDispatcherErrorHandler(DispatcherErrorHandler errorHandler) {
this.errorHandler = errorHandler;
@@ -188,7 +188,9 @@ public class PrepareOperations {
request.setAttribute(STRUTS_ACTION_MAPPING_KEY, mapping);
}
} catch (Exception ex) {
dispatcher.sendError(request, response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, ex);
if (dispatcher.isHandleException() || dispatcher.isDevMode()) {
dispatcher.sendError(request, response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, ex);
}
}
}