diff options
author | lalber <lukas.alber@iaik.tugraz.at> | 2021-03-12 16:11:07 +0100 |
---|---|---|
committer | lalber <lukas.alber@iaik.tugraz.at> | 2021-03-12 16:11:07 +0100 |
commit | b8d3937a99e54036be491b5df606ab6c5a81f480 (patch) | |
tree | 64bee8e19b981c5c82dd9c8931454edd56cc1612 /eaaf_core/src/main/java | |
parent | 4b71edc5036c28f861007543233991d02b11d778 (diff) | |
download | EAAF-Components-b8d3937a99e54036be491b5df606ab6c5a81f480.tar.gz EAAF-Components-b8d3937a99e54036be491b5df606ab6c5a81f480.tar.bz2 EAAF-Components-b8d3937a99e54036be491b5df606ab6c5a81f480.zip |
added some error Handling
Diffstat (limited to 'eaaf_core/src/main/java')
3 files changed, 16 insertions, 10 deletions
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ErrorTicketService.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ErrorTicketService.java index c5bac225..3471aebe 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ErrorTicketService.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ErrorTicketService.java @@ -92,7 +92,7 @@ public class ErrorTicketService { } } - public HandleData createHandleData(Throwable throwable, HttpServletRequest req) { + public HandleData createHandleData(Throwable throwable, HttpServletRequest req) throws EaafException { HandleData data = new HandleData(throwable, req); extractErrorCode(data); setUpErrorData(data); @@ -120,7 +120,7 @@ public class ErrorTicketService { } } - private void setUpErrorData(HandleData data) { + private void setUpErrorData(HandleData data) throws EaafException { if (propertyMap.containsKey(data.errorCode)) { String action = propertyMap.get(data.errorCode); @@ -145,7 +145,8 @@ public class ErrorTicketService { } else { data.generateSupportTicket(); - // TODO log with ticket gernal internal error + throw new EaafException("internal.configuration.00", new Object[] {data.errorCode + "in on_error_action" + + ".properties"}); } } 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()); diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/ProtocolFinalizationController.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/ProtocolFinalizationController.java index 37aab8df..26feb3db 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/ProtocolFinalizationController.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/ProtocolFinalizationController.java @@ -89,7 +89,6 @@ public class ProtocolFinalizationController extends AbstractController { pendingReq = container.getPendingRequest(); if (pendingReq != null) { - //TODO finish final Class<?> clazz = Class.forName(pendingReq.requestedModule()); if (clazz == null || !IModulInfo.class.isAssignableFrom(clazz)) { @@ -127,7 +126,6 @@ public class ProtocolFinalizationController extends AbstractController { * @throws EaafException In case of an internal error * @throws IOException In case of a servlet error */ - // TODO reuse for the redirection to SP or own enpoint @RequestMapping(value = ENDPOINT_ERRORHANDLING, method = {RequestMethod.GET, RequestMethod.POST}) public void errorHandling(final HttpServletRequest req, final HttpServletResponse resp) throws EaafException, IOException { |