From b3f78f57ff8da8a82af57377eaabea22031582e9 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Thu, 5 May 2022 17:26:27 +0200 Subject: chore(szr): optimize error-logging in case of SZR errors --- .../modules/auth/eidas/v2/szr/SzrClient.java | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'modules/authmodule-eIDAS-v2/src/main') diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/szr/SzrClient.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/szr/SzrClient.java index 11ea2843..11b1e589 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/szr/SzrClient.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/szr/SzrClient.java @@ -67,8 +67,6 @@ import org.apache.cxf.jaxws.DispatchImpl; import org.apache.cxf.transport.http.HTTPConduit; import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; import org.apache.xpath.XPathAPI; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.w3c.dom.Document; @@ -87,6 +85,7 @@ import at.gv.egiz.eaaf.core.api.idp.IConfiguration; import at.gv.egiz.eaaf.core.impl.utils.DomUtils; import at.gv.egiz.eaaf.core.impl.utils.FileUtils; import at.gv.egiz.eaaf.core.impl.utils.KeyStoreUtils; +import lombok.extern.slf4j.Slf4j; import szrservices.GetBPK; import szrservices.GetBPKResponse; import szrservices.GetIdentityLinkEidas; @@ -102,9 +101,9 @@ import szrservices.SignContentEntry; import szrservices.SignContentResponseType; +@Slf4j @Service("SZRClientForeIDAS") public class SzrClient { - private static final Logger log = LoggerFactory.getLogger(SzrClient.class); private static final String CLIENT_DEFAULT = "DefaultClient"; private static final String CLIENT_RAW = "RawClient"; @@ -187,7 +186,8 @@ public class SzrClient { return idl; } catch (final Exception e) { - log.warn("SZR communication FAILED. Reason: " + e.getMessage(), e); + log.warn("SZR communication FAILED for operation: {} Reason: {}", + "GetIdentityLinkEidas", e.getMessage(), e); throw new SzrCommunicationException("ernb.02", new Object[]{e.getMessage()}, e); } @@ -215,7 +215,8 @@ public class SzrClient { return result.getGetBPKReturn(); } catch (final SZRException_Exception e) { - log.warn("SZR communication FAILED. Reason: " + e.getMessage(), e); + log.warn("SZR communication FAILED for operation: {} Reason: {}", + "GetBPK", e.getMessage(), e); throw new SzrCommunicationException("ernb.02", new Object[]{e.getMessage()}, e); } @@ -235,12 +236,16 @@ public class SzrClient { final String resp; try { resp = this.szr.getStammzahlEncrypted(personInfo, insertErnp); + } catch (SZRException_Exception e) { + log.warn("SZR communication FAILED for operation: {} Reason: {}", + "getStammzahlEncrypted", e.getMessage(), e); throw new SzrCommunicationException("ernb.02", new Object[]{e.getMessage()}, e); } - if (StringUtils.isEmpty(resp)) { + if (StringUtils.isEmpty(resp)) { throw new SzrCommunicationException("ernb.01", new Object[]{"Stammzahl response empty"}); // TODO error handling + } return resp; @@ -305,7 +310,8 @@ public class SzrClient { return resp.getOut().get(0).getValue(); } catch (final JsonProcessingException | SZRException_Exception e) { - log.warn("Requesting bcBind by using SZR FAILED. Reason: {}", e.getMessage(), null, e); + log.warn("SZR communication FAILED for operation: {} Reason: {}", + "SignContent", e.getMessage(), e); throw new SzrCommunicationException("ernb.02", new Object[]{e.getMessage()}, e); } -- cgit v1.2.3