summaryrefslogtreecommitdiff
path: root/eaaf_core/src/main/java/at
diff options
context:
space:
mode:
authorThomas <>2021-02-24 08:50:14 +0100
committerThomas <>2021-02-24 08:50:14 +0100
commitda964d59a926c23ef6a14210b59de30742e1e45c (patch)
treea1a0731632555084fb2deef2a2ca696ad31b8041 /eaaf_core/src/main/java/at
parentae16000f4c82feff1f4f610d389153ae2e54c016 (diff)
downloadEAAF-Components-da964d59a926c23ef6a14210b59de30742e1e45c.tar.gz
EAAF-Components-da964d59a926c23ef6a14210b59de30742e1e45c.tar.bz2
EAAF-Components-da964d59a926c23ef6a14210b59de30742e1e45c.zip
update error-GUI form to differ between internal und external error-codes
Diffstat (limited to 'eaaf_core/src/main/java/at')
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java36
1 files changed, 22 insertions, 14 deletions
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java
index 99dda776..925d6fe2 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java
@@ -285,7 +285,10 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
// write generic message for general exceptions
final String msg =
statusMessager.getMessage(IStatusMessenger.CODES_INTERNAL_ERROR_GENERIC, null);
- writeHtmlErrorResponse(req, resp, msg, statusMessager.getResponseErrorCode(throwable), null);
+ final String internalErrorCode = statusMessager.getResponseErrorCode(throwable);
+
+ writeHtmlErrorResponse(req, resp, msg, internalErrorCode, null,
+ statusMessager.mapInternalErrorToExternalError(internalErrorCode));
}
@@ -459,7 +462,7 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
private void writeHtmlErrorResponse(@NonNull final HttpServletRequest httpReq,
@NonNull final HttpServletResponse httpResp, @NonNull final String msg,
- @NonNull final String errorCode, @Nullable final Object[] params) throws EaafException {
+ @NonNull final String errorCode, @Nullable final Object[] params, String externalErrorCode) throws EaafException {
try {
final IGuiBuilderConfiguration config =
@@ -486,6 +489,9 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
AbstractGuiFormBuilderConfiguration.PARAM_GROUP_MSG, PARAM_GUI_ERROMSG, msg);
((ModifyableGuiBuilderConfiguration) config).putCustomParameter(
AbstractGuiFormBuilderConfiguration.PARAM_GROUP_MSG, PARAM_GUI_ERRORCODE, errorCode);
+ ((ModifyableGuiBuilderConfiguration) config).putCustomParameter(
+ AbstractGuiFormBuilderConfiguration.PARAM_GROUP_MSG, PARAM_GUI_EXTERNAL_ERRORCODE,
+ externalErrorCode);
((ModifyableGuiBuilderConfiguration) config).putCustomParameterWithOutEscaption(
AbstractGuiFormBuilderConfiguration.PARAM_GROUP_MSG, PARAM_GUI_ERRORCODEPARAMS,
ArrayUtils.toString(errorCodeParams));
@@ -507,7 +513,9 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
private void internalMoaidExceptionHandler(final HttpServletRequest req,
final HttpServletResponse resp, final Exception e, final boolean writeExceptionToStatisicLog)
- throws IOException, EaafException {
+ throws IOException, EaafException {
+ final String internalErrorCode = statusMessager.getResponseErrorCode(e);
+
if (e instanceof ProtocolNotActiveException) {
resp.getWriter().write(Encode.forHtml(e.getMessage()));
resp.setContentType(EaafConstants.CONTENTTYPE_HTML_UTF8);
@@ -520,30 +528,30 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
if (writeExceptionToStatisicLog) {
statisticLogger.logErrorOperation(ex, ex.getErrorRequest());
}
-
+
// write error message
- writeHtmlErrorResponse(req, resp, e.getMessage(), statusMessager.getResponseErrorCode(e),
- null);
+ writeHtmlErrorResponse(req, resp, e.getMessage(), internalErrorCode, null,
+ statusMessager.mapInternalErrorToExternalError(internalErrorCode));
} else if (e instanceof InvalidProtocolRequestException) {
// send error response
- writeHtmlErrorResponse(req, resp, e.getMessage(), statusMessager.getResponseErrorCode(e),
- null);
+ writeHtmlErrorResponse(req, resp, e.getMessage(), internalErrorCode, null,
+ statusMessager.mapInternalErrorToExternalError(internalErrorCode));
} else if (e instanceof ConfigurationException) {
// send HTML formated error message
- writeHtmlErrorResponse(req, resp, e.getMessage(), statusMessager.getResponseErrorCode(e),
- null);
+ writeHtmlErrorResponse(req, resp, e.getMessage(), internalErrorCode, null,
+ statusMessager.mapInternalErrorToExternalError(internalErrorCode));
} else if (e instanceof EaafException) {
// send HTML formated error message
- writeHtmlErrorResponse(req, resp, e.getMessage(), statusMessager.getResponseErrorCode(e),
- ((EaafException) e).getParams());
+ writeHtmlErrorResponse(req, resp, e.getMessage(), internalErrorCode,
+ ((EaafException) e).getParams(), statusMessager.mapInternalErrorToExternalError(internalErrorCode));
} else if (e instanceof ProcessExecutionException) {
// send HTML formated error message
- writeHtmlErrorResponse(req, resp, e.getMessage(), statusMessager.getResponseErrorCode(e),
- null);
+ writeHtmlErrorResponse(req, resp, e.getMessage(), internalErrorCode, null,
+ statusMessager.mapInternalErrorToExternalError(internalErrorCode));
}