From 823d4ce2504444caac110d3506f82b4dfce4e05b Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Thu, 6 Jun 2019 13:31:28 +0200 Subject: change error messages in case of InvalidProtocolExceptions --- .../services/ProtocolAuthenticationService.java | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'eaaf_core') 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 087d83a2..0aa7ff89 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 @@ -373,16 +373,6 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer } } - private void writeBadRequestErrorResponse(final HttpServletRequest req, final HttpServletResponse resp, final EAAFException e) throws IOException { - final String code = statusMessager.mapInternalErrorToExternalError(((InvalidProtocolRequestException)e).getErrorId()); - final String descr = StringEscapeUtils.escapeHtml4(StringEscapeUtils.escapeEcmaScript(e.getMessage())); - resp.setContentType(EAAFConstants.CONTENTTYPE_HTML_UTF8); - resp.sendError(HttpServletResponse.SC_BAD_REQUEST, "Protocol validation FAILED!" + - "(Errorcode=" + code + - " | Description=" + descr + ")"); - - } - private void writeHTMLErrorResponse(@NonNull final HttpServletRequest httpReq, @NonNull final HttpServletResponse httpResp, @NonNull final String msg, @NonNull final String errorCode, @Nullable final Object[] params, @NonNull final Exception error) throws IOException, EAAFException { @@ -464,11 +454,21 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer statisticLogger.logErrorOperation(ex, ex.getErrorRequest()); //write error message - writeBadRequestErrorResponse(req, resp, (EAAFException) e); + //writeBadRequestErrorResponse(req, resp, (EAAFException) e); + writeHTMLErrorResponse(req, resp, + e.getMessage(), + statusMessager.getResponseErrorCode(e), + null, + e); } else if (e instanceof InvalidProtocolRequestException) { //send error response - writeBadRequestErrorResponse(req, resp, (EAAFException) e); + //writeBadRequestErrorResponse(req, resp, (EAAFException) e); + writeHTMLErrorResponse(req, resp, + e.getMessage(), + statusMessager.getResponseErrorCode(e), + null, + e); } else if (e instanceof ConfigurationException) { //send HTML formated error message -- cgit v1.2.3