diff options
3 files changed, 24 insertions, 15 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)); } diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/IStatusMessenger.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/IStatusMessenger.java index 28d21d89..daf2f6ff 100644 --- a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/IStatusMessenger.java +++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/IStatusMessenger.java @@ -59,7 +59,7 @@ public interface IStatusMessenger { String getMessageWithoutDefault(String messageId, Object[] parameters); /** - * Get external errorCode from from Exception. + * Get internal errorCode from from Exception. * * @param throwable Reason of error * @return external error code diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/auth/services/IProtocolAuthenticationService.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/auth/services/IProtocolAuthenticationService.java index 2c0fe55f..6580fa30 100644 --- a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/auth/services/IProtocolAuthenticationService.java +++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/auth/services/IProtocolAuthenticationService.java @@ -34,6 +34,7 @@ public interface IProtocolAuthenticationService { String PARAM_GUI_ERROMSG = "errorMsg"; String PARAM_GUI_ERRORCODE = "errorCode"; + String PARAM_GUI_EXTERNAL_ERRORCODE = "extErrorCode"; String PARAM_GUI_ERRORCODEPARAMS = "errorParams"; String PARAM_GUI_ERRORSTACKTRACE = "stacktrace"; |