diff options
Diffstat (limited to 'eaaf_core/src/main')
-rw-r--r-- | eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java | 56 |
1 files changed, 34 insertions, 22 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 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); } } |