summaryrefslogtreecommitdiff
path: root/eaaf_core/src
diff options
context:
space:
mode:
authorlalber <lukas.alber@iaik.tugraz.at>2021-03-12 16:11:07 +0100
committerThomas <>2021-03-30 20:22:06 +0200
commit9b5b4233e0ffbcd62de74770a492e24c3efe9b05 (patch)
treebe148b36687fb6f92a6677e2efb2d6944475ff73 /eaaf_core/src
parentc43d3f075ebf165a55935cd985fcfaf7426dc38d (diff)
downloadEAAF-Components-9b5b4233e0ffbcd62de74770a492e24c3efe9b05.tar.gz
EAAF-Components-9b5b4233e0ffbcd62de74770a492e24c3efe9b05.tar.bz2
EAAF-Components-9b5b4233e0ffbcd62de74770a492e24c3efe9b05.zip
added some error Handling
Diffstat (limited to 'eaaf_core/src')
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ErrorTicketService.java7
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java17
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/ProtocolFinalizationController.java2
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 d915910b..9627e01a 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
@@ -80,6 +80,8 @@ import at.gv.egiz.eaaf.core.impl.utils.KeyValueUtils;
import at.gv.egiz.eaaf.core.impl.utils.ServletUtils;
+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);
@@ -263,11 +265,10 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
}
- } catch (final Throwable e) {
+ } catch (final Throwable e) { //
handleErrorNoRedirect(throwable, req, resp, true);
}
-
}
@Override
@@ -284,8 +285,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
@@ -519,7 +526,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 e81b9058..9b7b0a02 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
@@ -96,7 +96,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)) {
@@ -134,7 +133,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 {