summaryrefslogtreecommitdiff
path: root/eaaf_core
diff options
context:
space:
mode:
authorThomas <>2021-03-03 19:28:11 +0100
committerThomas <>2021-03-03 19:28:11 +0100
commitfbcc941e3683cf02ead1aebb9f3de695a301b739 (patch)
tree3791374335278f95c5537d20bd044d08c057c2eb /eaaf_core
parent1b8d04783794837c0aca484953b3264028a49b9d (diff)
downloadEAAF-Components-fbcc941e3683cf02ead1aebb9f3de695a301b739.tar.gz
EAAF-Components-fbcc941e3683cf02ead1aebb9f3de695a301b739.tar.bz2
EAAF-Components-fbcc941e3683cf02ead1aebb9f3de695a301b739.zip
update default error-handling to optimize visualization
Diffstat (limited to 'eaaf_core')
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java26
1 files changed, 14 insertions, 12 deletions
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java
index 0479a8c5..b05d8df0 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java
@@ -26,7 +26,6 @@ import javax.annotation.Nullable;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.text.StringEscapeUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -96,11 +95,11 @@ public abstract class AbstractController {
protAuthService.handleErrorNoRedirect(e, req, resp, true);
} catch (final EaafException e1) {
+ log.warn("ErrorHandling failed with error: ", e.getMessage(), e);
log.warn("Can NOT handle an 'EAAFException'. Forwarding to generic error ... ", e);
ioExceptionHandler(resp, e);
}
-
}
/**
@@ -110,20 +109,23 @@ public abstract class AbstractController {
* This handler wrote an internal server error into http response
* </p>
*
- * @param resp http response
- * @param exception exception
+ * @param req http request
+ * @param resp http response
+ * @param e Catched exception
* @throws IOException In case of an internal error.
*/
@ExceptionHandler({ Exception.class })
- public void genericExceptionHandler(final HttpServletResponse resp, final Exception exception)
- throws IOException {
- log.error("Internel Server Error.", exception);
- resp.setContentType(EaafConstants.CONTENTTYPE_HTML_UTF8);
- resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Internal Server Error!"
- + "(Errorcode=9199" + " | Description="
- + StringEscapeUtils.escapeHtml4(StringEscapeUtils.escapeEcmaScript(exception.getMessage()))
- + ")");
+ public void genericExceptionHandler(final HttpServletRequest req, final HttpServletResponse resp,
+ final Exception e) throws IOException {
+ try {
+ protAuthService.handleErrorNoRedirect(e, req, resp, true);
+
+ } catch (final EaafException e1) {
+ log.warn("ErrorHandling failed with error: ", e.getMessage(), e);
+ log.error("Can NOT handle a generic 'Exception'. Forwarding to generic error ... ", e);
+ ioExceptionHandler(resp, e);
+ }
}
/**