summaryrefslogtreecommitdiff
path: root/eaaf_core/src/main
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2021-02-24 10:01:51 +0100
committerThomas Lenz <thomas.lenz@egiz.gv.at>2021-02-24 10:01:51 +0100
commit54736c76e0ce7187915ccf9dec7573c0ab12d0a8 (patch)
treea1a0731632555084fb2deef2a2ca696ad31b8041 /eaaf_core/src/main
parentbeb781fc5196ee4f630fe7d5c48617de5cf9f184 (diff)
parentda964d59a926c23ef6a14210b59de30742e1e45c (diff)
downloadEAAF-Components-54736c76e0ce7187915ccf9dec7573c0ab12d0a8.tar.gz
EAAF-Components-54736c76e0ce7187915ccf9dec7573c0ab12d0a8.tar.bz2
EAAF-Components-54736c76e0ce7187915ccf9dec7573c0ab12d0a8.zip
Merge branch 'feature/small_changes' into 'nightlyBuild'
Feature/small changes See merge request egiz/eaaf_components!19
Diffstat (limited to 'eaaf_core/src/main')
-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 4410267e..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, "9199", 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));
}