From 997119b8c25bb256c1bf937d427febf975d570ce Mon Sep 17 00:00:00 2001
From: lalber <lukas.alber@iaik.tugraz.at>
Date: Wed, 31 Mar 2021 15:38:44 +0200
Subject: inf recursion fix

---
 .../services/ProtocolAuthenticationService.java     | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 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 09977f52..c666eaa9 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
@@ -234,8 +234,8 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
     try {
       ErrorTicketService.HandleData errorData = errorTicketService.createHandleData(throwable, req);
 
-      if (errorData.getActionType().equals(ErrorTicketService.ActionType.TICKET_REDIRECT)
-          || errorData.getActionType().equals(ErrorTicketService.ActionType.NOTICKET_REDIRECT)) {
+      if (errorData.getActionType().equals(ErrorTicketService.ActionType.TICKET_REDIRECT) || errorData.getActionType()
+          .equals(ErrorTicketService.ActionType.NOTICKET_REDIRECT)) {
 
         // Put pending request
         ExceptionContainer exceptionContainer = new ExceptionContainer(protocolRequest, throwable);
@@ -340,13 +340,15 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
 
     } catch (EaafException e) {
       // retry
-      handleErrorNoRedirect(e, req, resp, writeExceptionToStatisticLog, true);
-
+      if (recall) {
+        handleErrorNoRedirect(e, req, resp, writeExceptionToStatisticLog, true);
+      }
     } catch (IOException e) {
       // retry
-      handleErrorNoRedirect(new EaafException(IStatusMessenger.CODES_INTERNAL_ERROR_GENERIC, null, e), req, resp,
-          writeExceptionToStatisticLog, true);
-
+      if (recall) {
+        handleErrorNoRedirect(new EaafException(IStatusMessenger.CODES_INTERNAL_ERROR_GENERIC, null, e), req, resp,
+            writeExceptionToStatisticLog, true);
+      }
     }
   }
 
@@ -603,9 +605,8 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
   private String generateErrorRedirectUrl(final HttpServletRequest req, String errorKey) {
     String redirectUrl = null;
     redirectUrl = ServletUtils.getBaseUrl(req);
-    redirectUrl +=
-        "/" + ProtocolFinalizationController.ENDPOINT_ERRORHANDLING + "?" + EaafConstants.PARAM_HTTP_ERROR_CODE + "="
-            + errorKey;
+    redirectUrl += "/" + ProtocolFinalizationController.ENDPOINT_ERRORHANDLING + "?"
+        + EaafConstants.PARAM_HTTP_ERROR_CODE + "=" + errorKey;
     return redirectUrl;
 
   }
-- 
cgit v1.2.3