summaryrefslogtreecommitdiff
path: root/eaaf_core/src/main
diff options
context:
space:
mode:
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 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));
}