From 69132ec5bc165395458e49c421d0f38925d16ec5 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 6 Nov 2020 11:17:30 +0100 Subject: adapt logging to improve debugging --- .../java/at/gv/egiz/eaaf/core/impl/idp/auth/RequestStorage.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth') diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/RequestStorage.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/RequestStorage.java index 48c9d1bd..86c50be0 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/RequestStorage.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/RequestStorage.java @@ -69,10 +69,17 @@ public class RequestStorage implements IRequestStorage { // search invalid pending-request for errorHandling IRequest invalidPendingRequest = null; - try { + try { if (StringUtils.isNotEmpty(e.getInvalidInternalPendingReqId())) { + log.debug("Searching for expired pendingRequest with Id: {} ... ", e.getInvalidInternalPendingReqId()); invalidPendingRequest = transactionStorage.get(e.getInvalidInternalPendingReqId(), IRequest.class); + log.debug("{} expired pendingReq. Set it into Exception ...", + invalidPendingRequest != null ? "Find" : "Find NO "); + + } else { + log.debug("Get no internal pendingRequestId. Expired pendingRequest can not be set"); + } } catch (final EaafException e1) { -- cgit v1.2.3 From 2c8d2e81c99615bd1f57fd19f18f1ce3e6d7efed Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 20 Nov 2020 11:45:20 +0100 Subject: fix bug in central error-handling that lead to a ClassCastException in some cases (Jira EID-647) --- .../services/ProtocolAuthenticationService.java | 56 +++++++++++++--------- 1 file changed, 34 insertions(+), 22 deletions(-) (limited to 'eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth') 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 98149957..8c258a14 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 @@ -29,6 +29,17 @@ import javax.naming.ConfigurationException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.text.StringEscapeUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.lang.NonNull; +import org.springframework.lang.Nullable; +import org.springframework.stereotype.Service; + import at.gv.egiz.components.eventlog.api.EventConstants; import at.gv.egiz.eaaf.core.api.IRequest; import at.gv.egiz.eaaf.core.api.IRequestStorage; @@ -59,6 +70,7 @@ import at.gv.egiz.eaaf.core.exceptions.GuiBuildException; import at.gv.egiz.eaaf.core.exceptions.InvalidProtocolRequestException; import at.gv.egiz.eaaf.core.exceptions.ProcessExecutionException; import at.gv.egiz.eaaf.core.exceptions.ProtocolNotActiveException; +import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException; import at.gv.egiz.eaaf.core.impl.data.Pair; import at.gv.egiz.eaaf.core.impl.gui.AbstractGuiFormBuilderConfiguration; import at.gv.egiz.eaaf.core.impl.http.HttpUtils; @@ -67,17 +79,6 @@ import at.gv.egiz.eaaf.core.impl.idp.controller.protocols.RequestImpl; import at.gv.egiz.eaaf.core.impl.utils.KeyValueUtils; import at.gv.egiz.eaaf.core.impl.utils.ServletUtils; -import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.text.StringEscapeUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; -import org.springframework.lang.NonNull; -import org.springframework.lang.Nullable; -import org.springframework.stereotype.Service; - @Service public class ProtocolAuthenticationService implements IProtocolAuthenticationService { private static final Logger log = LoggerFactory.getLogger(ProtocolAuthenticationService.class); @@ -379,21 +380,32 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer * * @param loggedException Exception to log */ - protected void logExceptionToTechnicalLog(final Throwable loggedException) { - if (!(loggedException instanceof EaafException - || loggedException instanceof ProcessExecutionException)) { + protected void logExceptionToTechnicalLog(final Throwable loggedException) { + // In case of a TaskExecutionException, which is only a container for process-errors, + // extract internal exception + Throwable toLog; + if (loggedException instanceof TaskExecutionException) { + toLog = ((TaskExecutionException)loggedException); + + } else { + toLog = loggedException; + + } + + // Log exception + if (!(toLog instanceof EaafException)) { log.error(TECH_LOG_MSG, IStatusMessenger.CODES_INTERNAL_ERROR_GENERIC, - loggedException.getMessage(), loggedException); + toLog.getMessage(), toLog); - } else { - if (loggedException instanceof EaafException - && logOnInfoLevel.contains(((EaafException) loggedException).getErrorId())) { - log.info(TECH_LOG_MSG, ((EaafException) loggedException).getErrorId(), - loggedException.getMessage(), loggedException); + } else { + if (toLog instanceof EaafException + && logOnInfoLevel.contains(((EaafException) toLog).getErrorId())) { + log.info(TECH_LOG_MSG, ((EaafException) toLog).getErrorId(), + toLog.getMessage(), toLog); } else { - log.warn(TECH_LOG_MSG, ((EaafException) loggedException).getErrorId(), - loggedException.getMessage(), loggedException); + log.warn(TECH_LOG_MSG, ((EaafException) toLog).getErrorId(), + toLog.getMessage(), toLog); } } -- cgit v1.2.3 From b6942870faa8aee99554de2a324634c92e8cbcaa Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Thu, 26 Nov 2020 17:37:53 +0100 Subject: fix codestyle issue --- .../impl/idp/auth/services/ProtocolAuthenticationService.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth') 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 8c258a14..50bf76db 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 @@ -384,8 +384,9 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer // In case of a TaskExecutionException, which is only a container for process-errors, // extract internal exception Throwable toLog; - if (loggedException instanceof TaskExecutionException) { - toLog = ((TaskExecutionException)loggedException); + if (loggedException instanceof TaskExecutionException + && ((TaskExecutionException)loggedException).getOriginalException() != null) { + toLog = ((TaskExecutionException)loggedException).getOriginalException(); } else { toLog = loggedException; @@ -398,8 +399,7 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer toLog.getMessage(), toLog); } else { - if (toLog instanceof EaafException - && logOnInfoLevel.contains(((EaafException) toLog).getErrorId())) { + if (logOnInfoLevel.contains(((EaafException) toLog).getErrorId())) { log.info(TECH_LOG_MSG, ((EaafException) toLog).getErrorId(), toLog.getMessage(), toLog); -- cgit v1.2.3