diff options
author | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2021-07-30 11:28:23 +0200 |
---|---|---|
committer | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2021-08-30 10:38:25 +0200 |
commit | ef16b7e22800a5b200e58dd83fc406bb94dd671a (patch) | |
tree | 45b1442789da4378e9182197916ea534f70eb433 /id/server/modules/moa-id-module-ehvd_integration | |
parent | e8fba75fda7841ba9ad584553abf23be1adee0ef (diff) | |
download | moa-id-spss-ef16b7e22800a5b200e58dd83fc406bb94dd671a.tar.gz moa-id-spss-ef16b7e22800a5b200e58dd83fc406bb94dd671a.tar.bz2 moa-id-spss-ef16b7e22800a5b200e58dd83fc406bb94dd671a.zip |
Log some EHVD faults on INFO level because they are well known
Diffstat (limited to 'id/server/modules/moa-id-module-ehvd_integration')
-rw-r--r-- | id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/service/EhvdCommunicationService.java | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/service/EhvdCommunicationService.java b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/service/EhvdCommunicationService.java index 51bae6dfd..a25a7f421 100644 --- a/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/service/EhvdCommunicationService.java +++ b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/service/EhvdCommunicationService.java @@ -5,6 +5,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.Set; import javax.annotation.Nonnull; import javax.annotation.PostConstruct; @@ -19,6 +20,8 @@ import org.apache.cxf.transport.http.HTTPConduit; import org.apache.cxf.transports.http.configuration.ProxyServerType; import org.springframework.beans.factory.annotation.Autowired; +import com.google.common.collect.Sets; + import at.gv.egiz.eaaf.core.api.data.PVPAttributeDefinitions; import at.gv.egiz.eaaf.core.api.idp.IConfiguration; import at.gv.egiz.eaaf.core.api.idp.auth.data.IIdentityLink; @@ -53,7 +56,9 @@ public class EhvdCommunicationService implements IEhvdCommunication { private static final String ERROR_EHVD_02 = "ehvd.02"; private static final String ERROR_EHVD_03 = "ehvd.03"; private static final String ERROR_CONFIG_05 = "config.05"; - + + private static final Set<String> SERVICE_ERRORS_LOG_INFO = Sets.newHashSet("6002"); + @Autowired IConfiguration config; @@ -98,12 +103,7 @@ public class EhvdCommunicationService implements IEhvdCommunication { return gdaResp; } catch (final SOAPFaultException e) { - // extract reason for this error - String errorMsg = e.getFault() != null - ? StringUtils.isNotEmpty(e.getFault().getFaultString()) ? e.getFault().getFaultString() : e.getMessage() - : e.getMessage(); - Logger.warn("EHVD communication failed with SOAP response: " + errorMsg, e); - throw new EhvdException(ERROR_EHVD_02, new Object[] {errorMsg}); + throw handleSoapFaultError(e); } catch (final Exception e) { Logger.error("EHVD communication failed with generic error: " + e.getMessage(), e); @@ -113,6 +113,27 @@ public class EhvdCommunicationService implements IEhvdCommunication { } + private EhvdException handleSoapFaultError(SOAPFaultException e) { + // extract reason for this error + String errorMsg = e.getFault() != null + ? StringUtils.isNotEmpty(e.getFault().getFaultString()) ? e.getFault().getFaultString() : e.getMessage() + : e.getMessage(); + + if (SERVICE_ERRORS_LOG_INFO.stream() + .filter(el -> errorMsg.contains(el)) + .findFirst() + .isPresent()) { + Logger.info("EHVD communication failed with SOAP response: " + errorMsg); + + } else { + Logger.warn("EHVD communication failed with SOAP response: " + errorMsg, e); + + } + + return new EhvdException(ERROR_EHVD_02, new Object[] {errorMsg}); + + } + private List<String> parseGdaResponse(GdaIndexResponse ehvdResp) throws EhvdException { if (ehvdResp.getGda() != null) { final GdaDescriptor gdaInfo = ehvdResp.getGda(); |