From cc54421d99604cd2f2b01846f94bb11fb192028d Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Mon, 7 Feb 2022 18:22:27 +0100 Subject: chore(matching): fix some code-style and code-quality issues --- .../auth/eidas/v2/clients/ernp/ErnpRestClient.java | 20 ++++++++++---------- .../v2/exception/ErnpRestCommunicationException.java | 5 +++++ .../auth/eidas/v2/tasks/CreateNewErnpEntryTask.java | 2 +- .../test/tasks/CreateIdentityLinkTaskEidNewTest.java | 4 ++-- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/ernp/ErnpRestClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/ernp/ErnpRestClient.java index 15b7573c..3c19e9c1 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/ernp/ErnpRestClient.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/ernp/ErnpRestClient.java @@ -86,7 +86,7 @@ import lombok.extern.slf4j.Slf4j; public class ErnpRestClient implements IErnpClient { private static final String ERROR_MATCHING_11 = "module.eidasauth.matching.11"; - private static final String ERROR_MATCHING_12 = "module.eidasauth.matching.12"; + //private static final String ERROR_MATCHING_12 = "module.eidasauth.matching.12"; private static final String ERROR_MATCHING_99 = "module.eidasauth.matching.99"; private static final String LOGMSG_MISSING_CONFIG = "Missing configuration with key: {0}"; @@ -95,8 +95,8 @@ public class ErnpRestClient implements IErnpClient { private static final String LOGMSG_ERNP_RESP_PROCESS = "Proces ERnP response during '{}' operation failes with msg: {}"; - private static final String LOGMSG_ERNP_REST_ERROR = - "ERnP anwser for transaction: {0} with code: {1} and message: {2}"; + //private static final String LOGMSG_ERNP_REST_ERROR = + // "ERnP anwser for transaction: {0} with code: {1} and message: {2}"; private static final String PROCESS_SEARCH_PERSONAL_IDENTIFIER = "Searching " + Constants.eIDAS_ATTR_PERSONALIDENTIFIER; @@ -429,7 +429,7 @@ public class ErnpRestClient implements IErnpClient { //TODO: search eIDAS has to be a LIST!!!!!! SuchEidas eidasInfos = new SuchEidas(); - searchInfos.setEidas(eidasInfos ); + searchInfos.setEidas(eidasInfos); return searchInfos; } @@ -542,7 +542,7 @@ public class ErnpRestClient implements IErnpClient { final Suchdaten searchInfos = new Suchdaten(); searchInfos.setFamilienname(registerResult.getFamilyName()); searchInfos.setVorname(registerResult.getGivenName()); - searchInfos.setGeburtsdatum(buildErnpBirthday(registerResult.getDateOfBirth())); + searchInfos.setGeburtsdatum(buildErnpBirthday(registerResult.getDateOfBirth())); final PersonSuchen personSuchen = new PersonSuchen(); personSuchen.setSuchoptionen(generateSearchParameters()); @@ -572,8 +572,8 @@ public class ErnpRestClient implements IErnpClient { Constants.eIDAS_ATTRURN_PERSONALIDENTIFIER, eidData.getPseudonym())); if (StringUtils.isNotEmpty(eidData.getPlaceOfBirth())) { - ernpReq.addEidasItem(buildNewEidasDocument(eidData.getCitizenCountryCode(), - Constants.eIDAS_ATTRURN_PLACEOFBIRTH, eidData.getPlaceOfBirth())); + ernpReq.addEidasItem(buildNewEidasDocument(eidData.getCitizenCountryCode(), + Constants.eIDAS_ATTRURN_PLACEOFBIRTH, eidData.getPlaceOfBirth())); } @@ -773,9 +773,9 @@ public class ErnpRestClient implements IErnpClient { public void handleError(ClientHttpResponse response) throws IOException { // TODO: opimize errorHandling based on response info's from real ERnP - List serverId = response.getHeaders().getOrEmpty(ERNP_RESPONSE_HEADER_SERVER_ID); - log.warn("Receive http-error: {} from ERnP with serverTransactionId", - response.getRawStatusCode(), serverId.isEmpty() ? "'not set'" : serverId.get(0)); + List serverId = response.getHeaders().getOrEmpty(ERNP_RESPONSE_HEADER_SERVER_ID); + log.warn("Receive http-error: {} from ERnP with serverTransactionId", + response.getRawStatusCode(), serverId.isEmpty() ? "'not set'" : serverId.get(0)); throw new ErnpRestCommunicationException(response.getRawStatusCode()); diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/exception/ErnpRestCommunicationException.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/exception/ErnpRestCommunicationException.java index e3224c93..566a8fa4 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/exception/ErnpRestCommunicationException.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/exception/ErnpRestCommunicationException.java @@ -16,6 +16,11 @@ public class ErnpRestCommunicationException extends IOException { @Getter int httpStatusCode; + /** + * ERnP communication error on HTTP REST level. + * + * @param rawStatusCode HTTP statuscode + */ public ErnpRestCommunicationException(int rawStatusCode) { super("ERnP service answers with an error and HTTP status-code: " + rawStatusCode); this.httpStatusCode = rawStatusCode; diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateNewErnpEntryTask.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateNewErnpEntryTask.java index b63b0ca0..c7843be5 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateNewErnpEntryTask.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateNewErnpEntryTask.java @@ -65,7 +65,7 @@ public class CreateNewErnpEntryTask extends AbstractAuthServletTask { /** * Constructor. - * @param szrClient SZR client for creating a new ERnP entry + * @param client SZR client for creating a new ERnP entry */ public CreateNewErnpEntryTask(@Autowired ErnpRestClient client) { this.ernpClient = client; diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateIdentityLinkTaskEidNewTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateIdentityLinkTaskEidNewTest.java index 14ace0b8..dbcc62dc 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateIdentityLinkTaskEidNewTest.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateIdentityLinkTaskEidNewTest.java @@ -211,7 +211,7 @@ public class CreateIdentityLinkTaskEidNewTest { String vsz = RandomStringUtils.randomNumeric(10); when(szrMock.getStammzahlEncrypted(any(), any())).thenReturn(vsz); - val signContentResp = new SignContentResponseType(); + SignContentResponseType signContentResp = new SignContentResponseType(); final SignContentEntry signContentEntry = new SignContentEntry(); signContentEntry.setValue(RandomStringUtils.randomAlphanumeric(10)); signContentResp.getOut().add(signContentEntry); @@ -333,7 +333,7 @@ public class CreateIdentityLinkTaskEidNewTest { //initialize test String vsz = RandomStringUtils.randomNumeric(10); when(szrMock.getStammzahlEncrypted(any(), any())).thenReturn(vsz); - val signContentResp = new SignContentResponseType(); + SignContentResponseType signContentResp = new SignContentResponseType(); final SignContentEntry signContentEntry = new SignContentEntry(); signContentEntry.setValue(RandomStringUtils.randomAlphanumeric(10)); signContentResp.getOut().add(signContentEntry); -- cgit v1.2.3