From b8d3937a99e54036be491b5df606ab6c5a81f480 Mon Sep 17 00:00:00 2001 From: lalber Date: Fri, 12 Mar 2021 16:11:07 +0100 Subject: added some error Handling --- .../auth/services/ProtocolAuthenticationService.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java') 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 8300c31f..bb6f45d0 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 @@ -77,6 +77,8 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.HashSet; +import static at.gv.egiz.eaaf.core.api.IStatusMessenger.CODES_INTERNAL_ERROR_GENERIC; + @Service public class ProtocolAuthenticationService implements IProtocolAuthenticationService { private static final Logger log = LoggerFactory.getLogger(ProtocolAuthenticationService.class); @@ -260,11 +262,10 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer } - } catch (final Throwable e) { + } catch (final Throwable e) { // handleErrorNoRedirect(throwable, req, resp, true); } - } @Override @@ -281,8 +282,14 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer // write errror to console logExceptionToTechnicalLog(errorData); - // return error to Web browser - displayException(req, resp, errorData); + if (errorData.getActionType().equals(ErrorTicketService.ActionType.NOTICKET_NOREDIRECT) || + errorData.getActionType().equals(ErrorTicketService.ActionType.TICKET_NOREDIRECT)) { + // return error to Web browser + displayException(req, resp, errorData); + } else { + throw new EaafException(IStatusMessenger.CODES_INTERNAL_ERROR_GENERIC, null, + new Exception("On Erroraction mapping mismatch", throwable)); + } } @Override @@ -516,7 +523,7 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer } else { // write generic message for general exceptions - final String msg = statusMessager.getMessage(IStatusMessenger.CODES_INTERNAL_ERROR_GENERIC, null); + final String msg = statusMessager.getMessage(CODES_INTERNAL_ERROR_GENERIC, null); writeHtmlErrorResponse(req, resp, msg, internalErrorCode, null, statusMessager.mapInternalErrorToExternalError(internalErrorCode), errorData.getRedirectUrl(), errorData.getSupportTicket()); -- cgit v1.2.3