From 2cf7ad2b7c736dd51015bb2f533c2a0cfc21e424 Mon Sep 17 00:00:00 2001 From: Misagh Moayyed Date: Thu, 28 Nov 2024 14:13:38 +0400 Subject: [PATCH] NOJIRA: remove redundant throws; use parameterized logs --- .../console/rest/AMSessionDeserializer.java | 3 +-- .../console/panels/search/SearchUtils.java | 2 +- .../client/lib/RestClientExceptionMapper.java | 4 ++-- .../client/self/SelfKeymasterServiceOps.java | 6 +++--- .../syncope/core/logic/wa/WAConfigLogic.java | 3 +-- .../syncope/core/logic/MailTemplateLogic.java | 2 +- .../syncope/core/logic/ReportLogic.java | 4 ++-- .../apache/syncope/core/logic/RoleLogic.java | 2 +- .../core/logic/SecurityQuestionLogic.java | 2 +- .../apache/syncope/core/logic/TaskLogic.java | 4 ++-- .../content/AbstractXMLContentLoader.java | 4 +--- .../common/dao/AbstractAnyMatchDAO.java | 4 ++-- .../validation/AttributableValidator.java | 6 +++--- .../validation/PropagationTaskValidator.java | 2 +- .../common/validation/ReportValidator.java | 2 +- .../common/validation/SchedTaskValidator.java | 2 +- .../core/provisioning/api/jexl/JexlUtils.java | 6 +++--- .../java/DefaultConnIdBundleManager.java | 5 ++--- .../java/DefaultMappingManager.java | 14 +++++-------- .../java/data/AbstractAnyDataBinder.java | 15 +++++++------ .../java/data/AnyObjectDataBinderImpl.java | 9 ++++---- .../java/data/NotificationDataBinderImpl.java | 4 ++-- .../java/data/PolicyDataBinderImpl.java | 2 +- .../java/data/RealmDataBinderImpl.java | 8 +++---- .../java/data/ResourceDataBinderImpl.java | 8 +++---- .../java/data/SchemaDataBinderImpl.java | 20 +++++++++--------- .../java/data/UserDataBinderImpl.java | 6 +++--- .../data/wa/WAClientAppDataBinderImpl.java | 2 +- .../java/job/DefaultJobManager.java | 8 +++---- .../AbstractPropagationTaskExecutor.java | 2 +- .../pushpull/AbstractPullResultHandler.java | 3 +-- .../DefaultRealmPullResultHandler.java | 3 +-- .../java/pushpull/SinglePushJobDelegate.java | 2 +- .../stream/StreamPullJobDelegate.java | 2 +- .../stream/StreamPushJobDelegate.java | 2 +- .../client/ElasticsearchUtils.java | 3 +-- .../java/job/ElasticsearchReindex.java | 21 +++++++++---------- .../core/logic/init/FlowableLoader.java | 2 +- .../opensearch/client/OpenSearchUtils.java | 3 +-- .../java/job/OpenSearchReindex.java | 21 +++++++++---------- .../ConnectorServerStartStopListener.java | 2 +- .../fit/buildtools/ServiceTimeoutServlet.java | 7 ++----- .../fit/buildtools/cxf/ProvisioningImpl.java | 14 ++++++------- .../flowable/AssignDirectorGroup.java | 2 +- .../flowable/CreateARelationship.java | 2 +- .../oidc/WAOIDCJWKSGeneratorService.java | 3 +-- 46 files changed, 116 insertions(+), 137 deletions(-) diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/rest/AMSessionDeserializer.java b/client/am/console/src/main/java/org/apache/syncope/client/console/rest/AMSessionDeserializer.java index 4eec9ef7d12..7444b2d82e4 100644 --- a/client/am/console/src/main/java/org/apache/syncope/client/console/rest/AMSessionDeserializer.java +++ b/client/am/console/src/main/java/org/apache/syncope/client/console/rest/AMSessionDeserializer.java @@ -20,7 +20,6 @@ import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonNode; @@ -50,7 +49,7 @@ public AMSessionDeserializer(final Class vc) { @Override public AMSession deserialize(final JsonParser jp, final DeserializationContext ctxt) - throws IOException, JsonProcessingException { + throws IOException { JsonNode node = jp.getCodec().readTree(jp); diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/SearchUtils.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/SearchUtils.java index d8606e53217..62b8aefe62e 100644 --- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/SearchUtils.java +++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/search/SearchUtils.java @@ -132,7 +132,7 @@ private static SearchClause getPrimitiveSearchClause(final SearchCondition s.replace(v, ENCODINGS.getKey(v))); clause.setValue(value); - LOG.debug("Condition: " + sc.getCondition()); + LOG.debug("Condition: {}", sc.getCondition()); if (SpecialAttr.ROLES.toString().equals(property)) { clause.setType(SearchClause.Type.ROLE_MEMBERSHIP); diff --git a/client/idrepo/lib/src/main/java/org/apache/syncope/client/lib/RestClientExceptionMapper.java b/client/idrepo/lib/src/main/java/org/apache/syncope/client/lib/RestClientExceptionMapper.java index 37a9a934ad1..9e2bb3b5221 100644 --- a/client/idrepo/lib/src/main/java/org/apache/syncope/client/lib/RestClientExceptionMapper.java +++ b/client/idrepo/lib/src/main/java/org/apache/syncope/client/lib/RestClientExceptionMapper.java @@ -117,7 +117,7 @@ private static SyncopeClientCompositeException checkSyncopeClientCompositeExcept try { exceptionType = ClientExceptionType.fromHeaderValue(exTypeAsString); } catch (IllegalArgumentException e) { - LOG.error("Unexpected value of " + RESTHeaders.ERROR_CODE + ": " + exTypeAsString, e); + LOG.error("Unexpected value of " + RESTHeaders.ERROR_CODE + ": {}", exTypeAsString, e); } if (exceptionType != null) { handledExceptions.add(exTypeAsString); @@ -136,7 +136,7 @@ private static SyncopeClientCompositeException checkSyncopeClientCompositeExcept exTypesInHeaders.removeAll(handledExceptions); if (!exTypesInHeaders.isEmpty()) { - LOG.error("Unmanaged exceptions: " + exTypesInHeaders); + LOG.error("Unmanaged exceptions: {}", exTypesInHeaders); } } else { for (ErrorTO error : errors) { diff --git a/common/keymaster/self/client-self/src/main/java/org/apache/syncope/common/keymaster/client/self/SelfKeymasterServiceOps.java b/common/keymaster/self/client-self/src/main/java/org/apache/syncope/common/keymaster/client/self/SelfKeymasterServiceOps.java index eaf58560a43..394bfccb8bb 100644 --- a/common/keymaster/self/client-self/src/main/java/org/apache/syncope/common/keymaster/client/self/SelfKeymasterServiceOps.java +++ b/common/keymaster/self/client-self/src/main/java/org/apache/syncope/common/keymaster/client/self/SelfKeymasterServiceOps.java @@ -107,14 +107,14 @@ private void retry( completionStage.whenComplete((response, throwable) -> { if (throwable == null && response.getStatus() < 300) { - LOG.info("{} successfully " + action + "ed", service); + LOG.info("{} successfully {}ed", service, action); } else { - LOG.error("Could not " + action + " {}", service, throwable); + LOG.error("Could not {} {}", action, service, throwable); handleRetry(service, action, retries, backOffExecution); } }).exceptionally(throwable -> { - LOG.error("Could not " + action + " {}", service, throwable); + LOG.error("Could not {} {}", action, service, throwable); handleRetry(service, action, retries, backOffExecution); diff --git a/core/am/logic/src/main/java/org/apache/syncope/core/logic/wa/WAConfigLogic.java b/core/am/logic/src/main/java/org/apache/syncope/core/logic/wa/WAConfigLogic.java index fbee16ef145..afafcba9443 100644 --- a/core/am/logic/src/main/java/org/apache/syncope/core/logic/wa/WAConfigLogic.java +++ b/core/am/logic/src/main/java/org/apache/syncope/core/logic/wa/WAConfigLogic.java @@ -117,8 +117,7 @@ protected void refresh(final HttpClient client, final String serviceAddress) { @PreAuthorize("hasRole('" + AMEntitlement.WA_CONFIG_PUSH + "')") public void pushToWA(final WAConfigService.PushSubject subject, final List services) { - HttpClient client = HttpClient.newHttpClient(); - try { + try (HttpClient client = HttpClient.newHttpClient()) { serviceOps.list(NetworkService.Type.WA).stream(). filter(wa -> CollectionUtils.isEmpty(services) || services.contains(wa.getAddress())). forEach(wa -> { diff --git a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/MailTemplateLogic.java b/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/MailTemplateLogic.java index 61f309b1399..35b507ffccc 100644 --- a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/MailTemplateLogic.java +++ b/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/MailTemplateLogic.java @@ -99,7 +99,7 @@ public String getFormat(final String key, final MailTemplateFormat format) { ? mailTemplate.getHTMLTemplate() : mailTemplate.getTextTemplate(); if (StringUtils.isBlank(template)) { - LOG.error("Could not find mail template '" + key + "' in " + format + " format"); + LOG.error("Could not find mail template '{}' in {} format", key, format); throw new NotFoundException(key + " in " + format); } diff --git a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/ReportLogic.java b/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/ReportLogic.java index a1a99669a5e..38efbd926ba 100644 --- a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/ReportLogic.java +++ b/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/ReportLogic.java @@ -100,7 +100,7 @@ public ReportTO create(final ReportTO reportTO) { AuthContextUtils.getUsername(), false); } catch (Exception e) { - LOG.error("While registering job for report " + report.getKey(), e); + LOG.error("While registering job for report {}", report.getKey(), e); SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.Scheduling); sce.getElements().add(e.getMessage()); @@ -124,7 +124,7 @@ public ReportTO update(final ReportTO reportTO) { AuthContextUtils.getUsername(), false); } catch (Exception e) { - LOG.error("While registering job for report " + report.getKey(), e); + LOG.error("While registering job for report {}", report.getKey(), e); SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.Scheduling); sce.getElements().add(e.getMessage()); diff --git a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/RoleLogic.java b/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/RoleLogic.java index 7c5ada538c1..1e948fe5daf 100644 --- a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/RoleLogic.java +++ b/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/RoleLogic.java @@ -92,7 +92,7 @@ public String getAnyLayout(final String key) { String consoleLayout = role.getAnyLayout(); if (StringUtils.isBlank(consoleLayout)) { - LOG.error("Could not find console layout for Role '" + key + '\''); + LOG.error("Could not find console layout for Role '{}'", key); throw new NotFoundException("Console layout for role " + key); } diff --git a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/SecurityQuestionLogic.java b/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/SecurityQuestionLogic.java index c9e6c195921..67a6bd9d0ee 100644 --- a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/SecurityQuestionLogic.java +++ b/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/SecurityQuestionLogic.java @@ -100,7 +100,7 @@ public SecurityQuestionTO readByUser(final String username) { orElseThrow(() -> new NotFoundException("User " + username)); if (user.getSecurityQuestion() == null) { - LOG.error("Could not find security question for user '" + username + '\''); + LOG.error("Could not find security question for user '{}'", username); throw new NotFoundException("Security question for user " + username); } diff --git a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java b/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java index ac427805a9f..4a8049a6269 100644 --- a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java +++ b/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java @@ -158,7 +158,7 @@ public T createSchedTask(final TaskType type, final T ta false, Map.of()); } catch (Exception e) { - LOG.error("While registering job for task " + task.getKey(), e); + LOG.error("While registering job for task {}", task.getKey(), e); SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.Scheduling); sce.getElements().add(e.getMessage()); @@ -195,7 +195,7 @@ public T updateSchedTask(final TaskType type, final Sche false, Map.of()); } catch (Exception e) { - LOG.error("While registering job for task " + task.getKey(), e); + LOG.error("While registering job for task {}", task.getKey(), e); SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.Scheduling); sce.getElements().add(e.getMessage()); diff --git a/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/content/AbstractXMLContentLoader.java b/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/content/AbstractXMLContentLoader.java index 01acacee4a5..c636bad86dd 100644 --- a/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/content/AbstractXMLContentLoader.java +++ b/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/content/AbstractXMLContentLoader.java @@ -28,8 +28,6 @@ import org.slf4j.LoggerFactory; import org.springframework.core.env.Environment; import org.xml.sax.SAXException; -import org.xml.sax.SAXNotRecognizedException; -import org.xml.sax.SAXNotSupportedException; public abstract class AbstractXMLContentLoader implements ContentLoader { @@ -53,7 +51,7 @@ public int getOrder() { protected abstract void createIndexes(String domain) throws IOException; protected SAXParser saxParser() - throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException, SAXException { + throws ParserConfigurationException, SAXException { SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE); diff --git a/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/dao/AbstractAnyMatchDAO.java b/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/dao/AbstractAnyMatchDAO.java index 4a8f688d5a2..0e2085d9abe 100644 --- a/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/dao/AbstractAnyMatchDAO.java +++ b/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/dao/AbstractAnyMatchDAO.java @@ -388,7 +388,7 @@ protected boolean matches(final Any any, final AttrCond cond, final boolean n validator.validate(schema, cond.getExpression(), attrValue); } } catch (ValidationException e) { - LOG.error("Could not validate expression '" + cond.getExpression() + '\'', e); + LOG.error("Could not validate expression '{}'", cond.getExpression(), e); return false; } @@ -469,7 +469,7 @@ protected boolean matches(final Any any, final AnyCond cond, final boolean no try { validator.validate(schema, cond.getExpression(), attrValue); } catch (ValidationException e) { - LOG.error("Could not validate expression '" + cond.getExpression() + '\'', e); + LOG.error("Could not validate expression '{}'", cond.getExpression(), e); return false; } } diff --git a/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/AttributableValidator.java b/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/AttributableValidator.java index 3d59c15744f..71d4b928365 100644 --- a/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/AttributableValidator.java +++ b/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/AttributableValidator.java @@ -89,7 +89,7 @@ protected boolean isValid(final PlainAttrValue value, final ConstraintValidatorC isValid = nonNullVales == 1; if (!isValid) { - LOG.error("More than one non-null value for " + value); + LOG.error("More than one non-null value for {}", value); context.buildConstraintViolationWithTemplate( AbstractValidator.getTemplate(EntityViolationType.MoreThanOneNonNull, @@ -104,8 +104,8 @@ protected boolean isValid(final PlainAttrValue value, final ConstraintValidatorC isValid = uniqueValueSchema.equals(attrSchema); if (!isValid) { - LOG.error("Unique value schema for " + value + " is " + uniqueValueSchema - + ", while owning attribute's schema is " + attrSchema); + LOG.error("Unique value schema for {} is {}, while owning attribute's schema is {}", + value, uniqueValueSchema, attrSchema); context.buildConstraintViolationWithTemplate( AbstractValidator.getTemplate(EntityViolationType.InvalidPlainAttr, diff --git a/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/PropagationTaskValidator.java b/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/PropagationTaskValidator.java index 507fce9f5f2..d910bf5a889 100644 --- a/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/PropagationTaskValidator.java +++ b/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/PropagationTaskValidator.java @@ -37,7 +37,7 @@ public boolean isValid(final PropagationTask task, final ConstraintValidatorCont try { ExecStatus.valueOf(execution.getStatus()); } catch (IllegalArgumentException e) { - LOG.error("Invalid execution status '" + execution.getStatus() + '\'', e); + LOG.error("Invalid execution status '{}'", execution.getStatus(), e); isValid = false; } } diff --git a/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/ReportValidator.java b/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/ReportValidator.java index 3a119f48cf6..d0d7e507479 100644 --- a/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/ReportValidator.java +++ b/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/ReportValidator.java @@ -44,7 +44,7 @@ public boolean isValid(final Report report, final ConstraintValidatorContext con try { CronExpression.parse(report.getCronExpression()); } catch (IllegalArgumentException e) { - LOG.error("Invalid cron expression '" + report.getCronExpression() + '\'', e); + LOG.error("Invalid cron expression '{}'", report.getCronExpression(), e); isValid = false; context.disableDefaultConstraintViolation(); diff --git a/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/SchedTaskValidator.java b/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/SchedTaskValidator.java index 45fe4e8d955..b5ca0c7f201 100644 --- a/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/SchedTaskValidator.java +++ b/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/SchedTaskValidator.java @@ -32,7 +32,7 @@ public boolean isValid(final SchedTask task, final ConstraintValidatorContext co try { CronExpression.parse(task.getCronExpression()); } catch (IllegalArgumentException e) { - LOG.error("Invalid cron expression '" + task.getCronExpression() + '\'', e); + LOG.error("Invalid cron expression '{}'", task.getCronExpression(), e); isValid = false; context.disableDefaultConstraintViolation(); diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/jexl/JexlUtils.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/jexl/JexlUtils.java index b7c8c725d13..b46c28dd6c3 100644 --- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/jexl/JexlUtils.java +++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/jexl/JexlUtils.java @@ -107,7 +107,7 @@ public static boolean isExpressionValid(final String expression) { getJexlEngine().createExpression(expression); result = true; } catch (JexlException e) { - LOG.error("Invalid JEXL expression: " + expression, e); + LOG.error("Invalid JEXL expression: {}", expression, e); result = false; } @@ -122,7 +122,7 @@ public static Object evaluateExpr(final String expression, final JexlContext jex JexlExpression jexlExpression = getJexlEngine().createExpression(expression); result = jexlExpression.evaluate(jexlContext); } catch (Exception e) { - LOG.error("Error while evaluating JEXL expression: " + expression, e); + LOG.error("Error while evaluating JEXL expression: {}", expression, e); } } else { LOG.debug("Expression not provided or invalid context"); @@ -140,7 +140,7 @@ public static String evaluateTemplate(final String template, final JexlContext j getJxltEngine().createTemplate(template).evaluate(jexlContext, writer); result = writer.toString(); } catch (Exception e) { - LOG.error("Error while evaluating JEXL template: " + template, e); + LOG.error("Error while evaluating JEXL template: {}", template, e); } } else { LOG.debug("Template not provided or invalid context"); diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultConnIdBundleManager.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultConnIdBundleManager.java index 5b2c01f742a..5da3886abc2 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultConnIdBundleManager.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultConnIdBundleManager.java @@ -220,9 +220,8 @@ public Pair getConnectorInfo(final ConnInstance connInstance connInstance.getBundleName(), connInstance.getVersion(), connInstance.getConnectorName()); if (LOG.isDebugEnabled()) { - LOG.debug("\nBundle name: " + key.getBundleName() - + "\nBundle version: " + key.getBundleVersion() - + "\nBundle class: " + key.getConnectorName()); + LOG.debug("\nBundle name: {}\nBundle version: {}\nBundle class: {}", + key.getBundleName(), key.getBundleVersion(), key.getConnectorName()); } // get the specified connector diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultMappingManager.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultMappingManager.java index 98bcc0b6147..1f3162c49a9 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultMappingManager.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultMappingManager.java @@ -559,15 +559,11 @@ public Pair prepareAttr( schemaType = intValues.getLeft(); List values = intValues.getRight(); - LOG.debug("Define mapping for: " - + "\n* ExtAttrName " + item.getExtAttrName() - + "\n* is connObjectKey " + item.isConnObjectKey() - + "\n* is password " + item.isPassword() - + "\n* mandatory condition " + item.getMandatoryCondition() - + "\n* Schema " + intAttrName.getSchema() - + "\n* ClassType " + schemaType.getType().getName() - + "\n* AttrSchemaType " + schemaType - + "\n* Values " + values); + LOG.debug("Define mapping for: \n* ExtAttrName {}\n* is connObjectKey {}\n" + + "* is password {}\n* mandatory condition {}\n* Schema {}\n" + + "* ClassType {}\n* AttrSchemaType {}\n* Values {}", + item.getExtAttrName(), item.isConnObjectKey(), item.isPassword(), item.getMandatoryCondition(), + intAttrName.getSchema(), schemaType.getType().getName(), schemaType, values); Pair result; if (readOnlyVirSchema) { diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java index 0ab69d01623..46c66ecb2a3 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java @@ -422,7 +422,7 @@ private void checkMandatory( && !schema.isReadonly() && JexlUtils.evaluateMandatoryCondition(schema.getMandatoryCondition(), any, derAttrHandler)) { - LOG.error("Mandatory schema " + schema.getKey() + " not provided with values"); + LOG.error("Mandatory schema {} not provided with values", schema.getKey()); reqValMissing.getElements().add(schema.getKey()); } @@ -517,8 +517,8 @@ protected void fill( any.getAuxClasses().remove(auxClass); } }, - () -> LOG.debug("Invalid " + AnyTypeClass.class.getSimpleName() + " {}, ignoring...", - patch.getValue())); + () -> LOG.debug("Invalid {} {}, ignoring...", + AnyTypeClass.class.getSimpleName(), patch.getValue())); } // 2. resources @@ -535,8 +535,8 @@ protected void fill( any.getResources().remove(resource); } }, - () -> LOG.debug("Invalid " + ExternalResource.class.getSimpleName() + " {}, ignoring...", - patch.getValue())); + () -> LOG.debug("Invalid {} {}, ignoring...", + ExternalResource.class.getSimpleName(), patch.getValue())); } Set resources = anyUtils.getAllResources(any); @@ -546,8 +546,7 @@ protected void fill( anyUR.getPlainAttrs().stream().filter(patch -> patch.getAttr() != null).forEach(patch -> { PlainSchema schema = getPlainSchema(patch.getAttr().getSchema()); if (schema == null) { - LOG.debug("Invalid " + PlainSchema.class.getSimpleName() + " {}, ignoring...", - patch.getAttr().getSchema()); + LOG.debug("Invalid {} {}, ignoring...", PlainSchema.class.getSimpleName(), patch.getAttr().getSchema()); } else { PlainAttr attr = (PlainAttr) any.getPlainAttr(schema.getKey()).orElse(null); if (attr == null) { @@ -620,7 +619,7 @@ protected void fill( flatMap(Optional::stream). forEach(auxClass -> { if (auxClass == null) { - LOG.debug("Invalid " + AnyTypeClass.class.getSimpleName() + " {}, ignoring...", auxClass); + LOG.debug("Invalid {} {}, ignoring...", AnyTypeClass.class.getSimpleName(), auxClass); } else { any.add(auxClass); } diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java index 961581761eb..4749ac04a69 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java @@ -231,7 +231,7 @@ public void create(final AnyObject anyObject, final AnyObjectCR anyObjectCR) { } else { AnyObject otherEnd = anyObjectDAO.findById(relationshipTO.getOtherEndKey()).orElse(null); if (otherEnd == null) { - LOG.debug("Ignoring invalid anyObject " + relationshipTO.getOtherEndKey()); + LOG.debug("Ignoring invalid anyObject {}", relationshipTO.getOtherEndKey()); } else if (relationships.contains(Pair.of(otherEnd.getKey(), relationshipTO.getType()))) { LOG.error("{} was already in relationship {} with {}", otherEnd, relationshipTO.getType(), anyObject); @@ -266,8 +266,7 @@ public void create(final AnyObject anyObject, final AnyObjectCR anyObjectCR) { ? groupDAO.findByName(membershipTO.getGroupName()).orElse(null) : groupDAO.findById(membershipTO.getGroupKey()).orElse(null); if (group == null) { - LOG.debug("Ignoring invalid group " - + membershipTO.getGroupKey() + " / " + membershipTO.getGroupName()); + LOG.debug("Ignoring invalid group {} / {}", membershipTO.getGroupKey(), membershipTO.getGroupName()); } else if (groups.contains(group.getKey())) { LOG.error("{} was already assigned to {}", group, anyObject); @@ -431,8 +430,8 @@ public PropagationByResource update(final AnyObject toBeUpdated, final A patch.getPlainAttrs().forEach(attrTO -> { PlainSchema schema = getPlainSchema(attrTO.getSchema()); if (schema == null) { - LOG.debug("Invalid " + PlainSchema.class.getSimpleName() - + "{}, ignoring...", attrTO.getSchema()); + LOG.debug("Invalid {}{}, ignoring...", + PlainSchema.class.getSimpleName(), attrTO.getSchema()); } else { Optional attr = anyObject.getPlainAttr(schema.getKey(), newMembership); diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/NotificationDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/NotificationDataBinderImpl.java index 69e3024fc29..c8e043a729f 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/NotificationDataBinderImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/NotificationDataBinderImpl.java @@ -177,8 +177,8 @@ public void update(final Notification notification, final NotificationTO notific } else { implementationDAO.findById(notificationTO.getRecipientsProvider()).ifPresentOrElse( notification::setRecipientsProvider, - () -> LOG.debug("Invalid " + Implementation.class.getSimpleName() + " {}, ignoring...", - notificationTO.getRecipientsProvider())); + () -> LOG.debug("Invalid {} {}, ignoring...", + Implementation.class.getSimpleName(), notificationTO.getRecipientsProvider())); } } } diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/PolicyDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/PolicyDataBinderImpl.java index 8ee139f35fd..271662aeea4 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/PolicyDataBinderImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/PolicyDataBinderImpl.java @@ -113,7 +113,7 @@ protected T getPolicy(final T policy, final PolicyTO policyTO accountPolicyTO.getRules().forEach(ruleKey -> implementationDAO.findById(ruleKey).ifPresentOrElse( accountPolicy::add, - () -> LOG.debug("Invalid " + Implementation.class.getSimpleName() + " {}, ignoring...", ruleKey))); + () -> LOG.debug("Invalid {} {}, ignoring...", Implementation.class.getSimpleName(), ruleKey))); // remove all implementations not contained in the TO accountPolicy.getRules(). removeIf(implementation -> !accountPolicyTO.getRules().contains(implementation.getKey())); diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java index e0e617ce59a..03c60307202 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java @@ -125,13 +125,13 @@ public Realm create(final Realm parent, final RealmTO realmTO) { realmTO.getActions().forEach(key -> implementationDAO.findById(key).ifPresentOrElse( realm::add, - () -> LOG.debug("Invalid " + Implementation.class.getSimpleName() + " {}, ignoring...", key))); + () -> LOG.debug("Invalid {} {}, ignoring...", Implementation.class.getSimpleName(), key))); setTemplates(realmTO, realm); realmTO.getResources().forEach(key -> resourceDAO.findById(key).ifPresentOrElse( realm::add, - () -> LOG.debug("Invalid " + ExternalResource.class.getSimpleName() + " {}, ignoring...", key))); + () -> LOG.debug("Invalid {} {}, ignoring...", ExternalResource.class.getSimpleName(), key))); return realm; } @@ -162,7 +162,7 @@ public PropagationByResource update(final Realm realm, final RealmTO rea realmTO.getActions().forEach(key -> implementationDAO.findById(key).ifPresentOrElse( realm::add, - () -> LOG.debug("Invalid " + Implementation.class.getSimpleName() + " {}, ignoring...", key))); + () -> LOG.debug("Invalid {} {}, ignoring...", Implementation.class.getSimpleName(), key))); // remove all implementations not contained in the TO realm.getActions(). removeIf(implementation -> !realmTO.getActions().contains(implementation.getKey())); @@ -175,7 +175,7 @@ public PropagationByResource update(final Realm realm, final RealmTO rea realm.add(resource); propByRes.add(ResourceOperation.CREATE, resource.getKey()); }, - () -> LOG.debug("Invalid " + ExternalResource.class.getSimpleName() + " {}, ignoring...", key))); + () -> LOG.debug("Invalid {} {}, ignoring...", ExternalResource.class.getSimpleName(), key))); // remove all resources not contained in the TO realm.getResources().removeIf(resource -> { boolean contained = realmTO.getResources().contains(resource.getKey()); diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java index e240615bca2..18c70ab728d 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java @@ -318,8 +318,8 @@ public ExternalResource update(final ExternalResource resource, final ResourceTO itemTO.getTransformers().forEach(key -> implementationDAO.findById(key).ifPresentOrElse( transformer -> item.getTransformers().add(transformer.getKey()), - () -> LOG.debug("Invalid " + Implementation.class.getSimpleName() + " {}, ignoring...", - key))); + () -> LOG.debug("Invalid {} {}, ignoring...", + Implementation.class.getSimpleName(), key))); // remove all implementations not contained in the TO item.getTransformers(). removeIf(implementation -> !itemTO.getTransformers().contains(implementation)); @@ -475,8 +475,8 @@ protected void populateMapping( itemTO.getTransformers().forEach(key -> implementationDAO.findById(key).ifPresentOrElse( transformer -> item.getTransformers().add(transformer.getKey()), - () -> LOG.debug("Invalid " + Implementation.class.getSimpleName() + " {}, ignoring...", - key))); + () -> LOG.debug("Invalid {} {}, ignoring...", + Implementation.class.getSimpleName(), key))); // remove all implementations not contained in the TO item.getTransformers(). removeIf(implementation -> !itemTO.getTransformers().contains(implementation)); diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SchemaDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SchemaDataBinderImpl.java index 91e2d9eec4f..89d7f4292ce 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SchemaDataBinderImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SchemaDataBinderImpl.java @@ -115,8 +115,8 @@ protected PlainSchema fill(final PlainSchema schema, final PlainSchemaTO schemaT } else { implementationDAO.findById(schemaTO.getDropdownValueProvider()).ifPresentOrElse( schema::setDropdownValueProvider, - () -> LOG.debug("Invalid " + Implementation.class.getSimpleName() + " {}, ignoring...", - schemaTO.getDropdownValueProvider())); + () -> LOG.debug("Invalid {} {}, ignoring...", + Implementation.class.getSimpleName(), schemaTO.getDropdownValueProvider())); } schema.setMandatoryCondition(schemaTO.getMandatoryCondition()); @@ -134,8 +134,8 @@ protected PlainSchema fill(final PlainSchema schema, final PlainSchemaTO schemaT } else { implementationDAO.findById(schemaTO.getValidator()).ifPresentOrElse( schema::setValidator, - () -> LOG.debug("Invalid " + Implementation.class.getSimpleName() + " {}, ignoring...", - schemaTO.getValidator())); + () -> LOG.debug("Invalid {} {}, ignoring...", + Implementation.class.getSimpleName(), schemaTO.getValidator())); } PlainSchema saved = plainSchemaDAO.save(schema); @@ -152,8 +152,8 @@ protected PlainSchema fill(final PlainSchema schema, final PlainSchemaTO schemaT atc.set(anyTypeClass); }, - () -> LOG.debug("Invalid " + AnyTypeClass.class.getSimpleName() + "{}, ignoring...", - schemaTO.getAnyTypeClass())); + () -> LOG.debug("Invalid {}{}, ignoring...", + AnyTypeClass.class.getSimpleName(), schemaTO.getAnyTypeClass())); } else if (schemaTO.getAnyTypeClass() == null && saved.getAnyTypeClass() != null) { saved.getAnyTypeClass().getPlainSchemas().remove(saved); saved.setAnyTypeClass(null); @@ -272,8 +272,8 @@ protected DerSchema fill(final DerSchema schema, final DerSchemaTO schemaTO) { atc.set(anyTypeClass); }, - () -> LOG.debug("Invalid " + AnyTypeClass.class.getSimpleName() + "{}, ignoring...", - schemaTO.getAnyTypeClass())); + () -> LOG.debug("Invalid {}{}, ignoring...", + AnyTypeClass.class.getSimpleName(), schemaTO.getAnyTypeClass())); } else if (schemaTO.getAnyTypeClass() == null && saved.getAnyTypeClass() != null) { saved.getAnyTypeClass().getDerSchemas().remove(saved); saved.setAnyTypeClass(null); @@ -352,8 +352,8 @@ protected VirSchema fill(final VirSchema schema, final VirSchemaTO schemaTO) { atc.set(anyTypeClass); }, - () -> LOG.debug("Invalid " + AnyTypeClass.class.getSimpleName() + "{}, ignoring...", - schemaTO.getAnyTypeClass())); + () -> LOG.debug("Invalid {}{}, ignoring...", + AnyTypeClass.class.getSimpleName(), schemaTO.getAnyTypeClass())); } else if (schemaTO.getAnyTypeClass() == null && saved.getAnyTypeClass() != null) { saved.getAnyTypeClass().getVirSchemas().remove(saved); saved.setAnyTypeClass(null); diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java index a7ae6403d11..cfd2e6984bf 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java @@ -346,7 +346,7 @@ public void create(final User user, final UserCR userCR) { userCR.getRelationships().forEach(relationshipTO -> { AnyObject otherEnd = anyObjectDAO.findById(relationshipTO.getOtherEndKey()).orElse(null); if (otherEnd == null) { - LOG.debug("Ignoring invalid anyObject " + relationshipTO.getOtherEndKey()); + LOG.debug("Ignoring invalid anyObject {}", relationshipTO.getOtherEndKey()); } else if (relationships.contains(Pair.of(otherEnd.getKey(), relationshipTO.getType()))) { LOG.error("{} was already in relationship {} with {}", otherEnd, relationshipTO.getType(), user); @@ -627,8 +627,8 @@ public Pair, PropagationByResource { PlainSchema schema = getPlainSchema(attrTO.getSchema()); if (schema == null) { - LOG.debug("Invalid " + PlainSchema.class.getSimpleName() - + "{}, ignoring...", attrTO.getSchema()); + LOG.debug("Invalid {}{}, ignoring...", + PlainSchema.class.getSimpleName(), attrTO.getSchema()); } else { UPlainAttr attr = user.getPlainAttr(schema.getKey(), newMembership).orElse(null); if (attr == null) { diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/wa/WAClientAppDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/wa/WAClientAppDataBinderImpl.java index 3895cd13c84..9efb300c219 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/wa/WAClientAppDataBinderImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/wa/WAClientAppDataBinderImpl.java @@ -71,7 +71,7 @@ public WAClientApp getWAClientApp(final ClientApp clientApp) { if (authPolicyConf instanceof DefaultAuthPolicyConf defaultAuthPolicyConf) { defaultAuthPolicyConf.getAuthModules().forEach(key -> authModuleDAO.findById(key).ifPresentOrElse( module -> waClientApp.getAuthModules().add(authModuleDataBinder.getAuthModuleTO(module)), - () -> LOG.warn("AuthModule " + key + " not found"))); + () -> LOG.warn("AuthModule {} not found", key))); } if (clientApp.getAccessPolicy() != null) { diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/DefaultJobManager.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/DefaultJobManager.java index 535359b3f6b..cb0064cf32f 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/DefaultJobManager.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/DefaultJobManager.java @@ -272,7 +272,7 @@ public void load(final String domain) { try { register(domain, task, task.getStartAt(), securityProperties.getAdminUser(), false, Map.of()); } catch (Exception e) { - LOG.error("While loading job instance for task " + task.getKey(), e); + LOG.error("While loading job instance for task {}", task.getKey(), e); loadException = true; } } @@ -286,7 +286,7 @@ public void load(final String domain) { try { register(domain, report, null, securityProperties.getAdminUser(), false); } catch (Exception e) { - LOG.error("While loading job instance for report " + report.getName(), e); + LOG.error("While loading job instance for report {}", report.getName(), e); loadException = true; } } @@ -353,7 +353,7 @@ public void unload(final String domain) { try { unregister(task); } catch (Exception e) { - LOG.error("While unloading job instance for task " + task.getKey(), e); + LOG.error("While unloading job instance for task {}", task.getKey(), e); } }); @@ -362,7 +362,7 @@ public void unload(final String domain) { try { unregister(report); } catch (Exception e) { - LOG.error("While unloading job instance for report " + report.getName(), e); + LOG.error("While unloading job instance for report {}", report.getName(), e); } }); }); diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java index 78ea26caa59..ab6ac761705 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java @@ -606,7 +606,7 @@ protected TaskExec doExecute( propagationAttempted.set(true); - LOG.error("Exception during provision on resource " + taskInfo.getResource().getKey(), e); + LOG.error("Exception during provision on resource {}", taskInfo.getResource().getKey(), e); if (e instanceof ConnectorException && e.getCause() != null) { taskExecutionMessage = e.getCause().getMessage(); diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPullResultHandler.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPullResultHandler.java index 544df593b77..390c6eed8d6 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPullResultHandler.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPullResultHandler.java @@ -170,8 +170,7 @@ public boolean handle(final SyncDelta delta) { } } - protected void throwIgnoreProvisionException(final SyncDelta delta, final Exception exception) - throws JobExecutionException { + protected void throwIgnoreProvisionException(final SyncDelta delta, final Exception exception) { if (exception instanceof IgnoreProvisionException) { throw IgnoreProvisionException.class.cast(exception); diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/DefaultRealmPullResultHandler.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/DefaultRealmPullResultHandler.java index 9cf347ce540..e36f2ba809b 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/DefaultRealmPullResultHandler.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/DefaultRealmPullResultHandler.java @@ -129,8 +129,7 @@ public boolean handle(final SyncDelta delta) { } } - protected void throwIgnoreProvisionException(final SyncDelta delta, final Exception exception) - throws JobExecutionException { + protected void throwIgnoreProvisionException(final SyncDelta delta, final Exception exception) { if (exception instanceof IgnoreProvisionException) { throw IgnoreProvisionException.class.cast(exception); diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/SinglePushJobDelegate.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/SinglePushJobDelegate.java index a24cede99ed..dd490c21afd 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/SinglePushJobDelegate.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/SinglePushJobDelegate.java @@ -52,7 +52,7 @@ protected void before( final ExternalResource resource, final Connector connector, final PushTaskTO pushTaskTO, - final String executor) throws JobExecutionException { + final String executor) { LOG.debug("Executing push on {}", resource); diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/stream/StreamPullJobDelegate.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/stream/StreamPullJobDelegate.java index fcc875f7df7..19ba71043ef 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/stream/StreamPullJobDelegate.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/stream/StreamPullJobDelegate.java @@ -74,7 +74,7 @@ private PullPolicy pullPolicy( if (pullCorrelationRule != null) { Implementation impl = implementationDAO.findById(pullCorrelationRule).orElse(null); if (impl == null || !IdMImplementationType.PULL_CORRELATION_RULE.equals(impl.getType())) { - LOG.debug("Invalid " + Implementation.class.getSimpleName() + " {}, ignoring...", pullCorrelationRule); + LOG.debug("Invalid {} {}, ignoring...", Implementation.class.getSimpleName(), pullCorrelationRule); } else { pullCorrelationRuleEntity = entityFactory.newEntity(PullCorrelationRuleEntity.class); pullCorrelationRuleEntity.setAnyType(anyType); diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/stream/StreamPushJobDelegate.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/stream/StreamPushJobDelegate.java index 1a54e0178c5..ee33c89f7a0 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/stream/StreamPushJobDelegate.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/stream/StreamPushJobDelegate.java @@ -104,7 +104,7 @@ private ExternalResource externalResource( propagationActions.forEach(key -> { Implementation impl = implementationDAO.findById(key).orElse(null); if (impl == null || !IdMImplementationType.PROPAGATION_ACTIONS.equals(impl.getType())) { - LOG.debug("Invalid " + Implementation.class.getSimpleName() + " {}, ignoring...", key); + LOG.debug("Invalid {} {}, ignoring...", Implementation.class.getSimpleName(), key); } else { resource.add(impl); } diff --git a/ext/elasticsearch/client-elasticsearch/src/main/java/org/apache/syncope/ext/elasticsearch/client/ElasticsearchUtils.java b/ext/elasticsearch/client-elasticsearch/src/main/java/org/apache/syncope/ext/elasticsearch/client/ElasticsearchUtils.java index 2fe3ac0ab2a..05d7a657b79 100644 --- a/ext/elasticsearch/client-elasticsearch/src/main/java/org/apache/syncope/ext/elasticsearch/client/ElasticsearchUtils.java +++ b/ext/elasticsearch/client-elasticsearch/src/main/java/org/apache/syncope/ext/elasticsearch/client/ElasticsearchUtils.java @@ -18,7 +18,6 @@ */ package org.apache.syncope.ext.elasticsearch.client; -import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -250,7 +249,7 @@ public Map document(final Realm realm) { protected void customizeDocument(final Map builder, final Realm realm) { } - public Map document(final AuditEvent auditEvent) throws IOException { + public Map document(final AuditEvent auditEvent) { Map builder = new HashMap<>(); builder.put("key", auditEvent.getKey()); builder.put("opEvent", auditEvent.getOpEvent()); diff --git a/ext/elasticsearch/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/ElasticsearchReindex.java b/ext/elasticsearch/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/ElasticsearchReindex.java index 35ec1525617..38fd6031ade 100644 --- a/ext/elasticsearch/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/ElasticsearchReindex.java +++ b/ext/elasticsearch/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/ElasticsearchReindex.java @@ -27,7 +27,6 @@ import co.elastic.clients.elasticsearch.core.BulkResponse; import co.elastic.clients.elasticsearch.core.bulk.BulkResponseItem; import co.elastic.clients.elasticsearch.indices.IndexSettings; -import java.io.IOException; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -117,43 +116,43 @@ public void afterBulk( @Autowired protected RealmDAO realmDAO; - protected IndexSettings userSettings() throws IOException { + protected IndexSettings userSettings() { return indexManager.defaultSettings(); } - protected IndexSettings groupSettings() throws IOException { + protected IndexSettings groupSettings() { return indexManager.defaultSettings(); } - protected IndexSettings anyObjectSettings() throws IOException { + protected IndexSettings anyObjectSettings() { return indexManager.defaultSettings(); } - protected IndexSettings realmSettings() throws IOException { + protected IndexSettings realmSettings() { return indexManager.defaultSettings(); } - protected IndexSettings auditSettings() throws IOException { + protected IndexSettings auditSettings() { return indexManager.defaultSettings(); } - protected TypeMapping userMapping() throws IOException { + protected TypeMapping userMapping() { return indexManager.defaultAnyMapping(); } - protected TypeMapping groupMapping() throws IOException { + protected TypeMapping groupMapping() { return indexManager.defaultAnyMapping(); } - protected TypeMapping anyObjectMapping() throws IOException { + protected TypeMapping anyObjectMapping() { return indexManager.defaultAnyMapping(); } - protected TypeMapping realmMapping() throws IOException { + protected TypeMapping realmMapping() { return indexManager.defaultRealmMapping(); } - protected TypeMapping auditMapping() throws IOException { + protected TypeMapping auditMapping() { return indexManager.defaultAuditMapping(); } diff --git a/ext/flowable/logic/src/main/java/org/apache/syncope/core/logic/init/FlowableLoader.java b/ext/flowable/logic/src/main/java/org/apache/syncope/core/logic/init/FlowableLoader.java index c07826cc04d..3e741d47eb4 100644 --- a/ext/flowable/logic/src/main/java/org/apache/syncope/core/logic/init/FlowableLoader.java +++ b/ext/flowable/logic/src/main/java/org/apache/syncope/core/logic/init/FlowableLoader.java @@ -66,7 +66,7 @@ public void load(final String domain) { try (InputStream wfIn = userWorkflowDef.getInputStream()) { wfDef = IOUtils.toByteArray(wfIn); } catch (IOException e) { - LOG.error("While loading " + userWorkflowDef.getFilename(), e); + LOG.error("While loading {}", userWorkflowDef.getFilename(), e); } ProcessEngine processEngine = dpEngine.getEngines().get(domain); diff --git a/ext/opensearch/client-opensearch/src/main/java/org/apache/syncope/ext/opensearch/client/OpenSearchUtils.java b/ext/opensearch/client-opensearch/src/main/java/org/apache/syncope/ext/opensearch/client/OpenSearchUtils.java index b9b4ab09302..3191550835d 100644 --- a/ext/opensearch/client-opensearch/src/main/java/org/apache/syncope/ext/opensearch/client/OpenSearchUtils.java +++ b/ext/opensearch/client-opensearch/src/main/java/org/apache/syncope/ext/opensearch/client/OpenSearchUtils.java @@ -18,7 +18,6 @@ */ package org.apache.syncope.ext.opensearch.client; -import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -250,7 +249,7 @@ public Map document(final Realm realm) { protected void customizeDocument(final Map builder, final Realm realm) { } - public Map document(final AuditEvent auditEvent) throws IOException { + public Map document(final AuditEvent auditEvent) { Map builder = new HashMap<>(); builder.put("key", auditEvent.getKey()); builder.put("opEvent", auditEvent.getOpEvent()); diff --git a/ext/opensearch/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/OpenSearchReindex.java b/ext/opensearch/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/OpenSearchReindex.java index bf17760e590..693c492076a 100644 --- a/ext/opensearch/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/OpenSearchReindex.java +++ b/ext/opensearch/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/OpenSearchReindex.java @@ -18,7 +18,6 @@ */ package org.apache.syncope.core.provisioning.java.job; -import java.io.IOException; import org.apache.syncope.common.lib.types.AnyTypeKind; import org.apache.syncope.core.persistence.api.dao.AnyDAO; import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO; @@ -72,43 +71,43 @@ public class OpenSearchReindex extends AbstractSchedTaskJobDelegate { @Autowired protected RealmDAO realmDAO; - protected IndexSettings userSettings() throws IOException { + protected IndexSettings userSettings() { return indexManager.defaultSettings(); } - protected IndexSettings groupSettings() throws IOException { + protected IndexSettings groupSettings() { return indexManager.defaultSettings(); } - protected IndexSettings anyObjectSettings() throws IOException { + protected IndexSettings anyObjectSettings() { return indexManager.defaultSettings(); } - protected IndexSettings realmSettings() throws IOException { + protected IndexSettings realmSettings() { return indexManager.defaultSettings(); } - protected IndexSettings auditSettings() throws IOException { + protected IndexSettings auditSettings() { return indexManager.defaultSettings(); } - protected TypeMapping userMapping() throws IOException { + protected TypeMapping userMapping() { return indexManager.defaultAnyMapping(); } - protected TypeMapping groupMapping() throws IOException { + protected TypeMapping groupMapping() { return indexManager.defaultAnyMapping(); } - protected TypeMapping anyObjectMapping() throws IOException { + protected TypeMapping anyObjectMapping() { return indexManager.defaultAnyMapping(); } - protected TypeMapping realmMapping() throws IOException { + protected TypeMapping realmMapping() { return indexManager.defaultRealmMapping(); } - protected TypeMapping auditMapping() throws IOException { + protected TypeMapping auditMapping() { return indexManager.defaultAuditMapping(); } diff --git a/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/ConnectorServerStartStopListener.java b/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/ConnectorServerStartStopListener.java index 8d93de431bc..bcc0da19acd 100644 --- a/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/ConnectorServerStartStopListener.java +++ b/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/ConnectorServerStartStopListener.java @@ -59,7 +59,7 @@ private static List getBundleURLs(final ApplicationContext ctx) { LOG.error("While getting bundled ConnId bundles", e); } - LOG.info("ConnId bundles loaded: " + bundleURLs); + LOG.info("ConnId bundles loaded: {}", bundleURLs); return bundleURLs; } diff --git a/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/ServiceTimeoutServlet.java b/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/ServiceTimeoutServlet.java index 0a833e8f629..fe421add6e9 100644 --- a/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/ServiceTimeoutServlet.java +++ b/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/ServiceTimeoutServlet.java @@ -18,7 +18,6 @@ */ package org.apache.syncope.fit.buildtools; -import jakarta.servlet.ServletException; import jakarta.servlet.annotation.WebServlet; import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; @@ -65,12 +64,11 @@ protected static void processRequest(final HttpServletRequest request, final Htt * * @param request servlet request * @param response servlet response - * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(final HttpServletRequest request, final HttpServletResponse response) - throws ServletException, IOException { + throws IOException { processRequest(request, response); } @@ -81,12 +79,11 @@ protected void doGet(final HttpServletRequest request, final HttpServletResponse * * @param request servlet request * @param response servlet response - * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(final HttpServletRequest request, final HttpServletResponse response) - throws ServletException, IOException { + throws IOException { processRequest(request, response); } diff --git a/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/cxf/ProvisioningImpl.java b/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/cxf/ProvisioningImpl.java index 501e801a366..42fa177d528 100644 --- a/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/cxf/ProvisioningImpl.java +++ b/fit/build-tools/src/main/java/org/apache/syncope/fit/buildtools/cxf/ProvisioningImpl.java @@ -68,7 +68,7 @@ public String delete(final String accountid) throws ProvisioningException { statement.setString(1, accountid); String query = "DELETE FROM testuser WHERE userId='" + accountid + "';"; - LOG.debug("Execute query: " + query); + LOG.debug("Execute query: {}", query); statement.executeUpdate(); } @@ -156,7 +156,7 @@ public String update(final String accountid, final List data) conn.prepareStatement("UPDATE testuser SET " + set.toString() + " WHERE userId=?")) { statement.setString(1, accountid); String query = "UPDATE testuser SET " + set.toString() + " WHERE userId='" + accountid + "';"; - LOG.debug("Execute query: " + query); + LOG.debug("Execute query: {}", query); statement.executeUpdate(); } @@ -290,13 +290,13 @@ public String create(final List data) throws ProvisioningExcep } } query = "INSERT INTO testuser (" + keys.toString() + ") VALUES (" + values.toString() + ')'; - LOG.debug("Execute query: " + query); + LOG.debug("Execute query: {}", query); statement.executeUpdate(query); } return accountid; } catch (SQLException e) { - LOG.error("Creation failed:\n" + query, e); + LOG.error("Creation failed:\n{}", query, e); throw new ProvisioningException("Create operation failed", e); } finally { DataSourceUtils.releaseConnection(conn, dataSource); @@ -322,7 +322,7 @@ public List sync() { @Override public String resolve(final String username) throws ProvisioningException { - LOG.debug("Resolve request operation received: " + username); + LOG.debug("Resolve request operation received: {}", username); String resolved = ""; @@ -333,7 +333,7 @@ public String resolve(final String username) throws ProvisioningException { statement.setString(1, username); String query = "SELECT userId FROM testuser WHERE userId='" + username + "';"; - LOG.debug("Execute query: " + query); + LOG.debug("Execute query: {}", query); ResultSet rs = statement.executeQuery(); @@ -345,7 +345,7 @@ public String resolve(final String username) throws ProvisioningException { statement = conn.prepareStatement("SELECT roleName FROM role WHERE roleName=?"); statement.setString(1, username); final String roleQuery = "SELECT roleName FROM role WHERE roleName='" + username + "';"; - LOG.debug("Execute query: " + roleQuery); + LOG.debug("Execute query: {}", roleQuery); rs = statement.executeQuery(); diff --git a/fit/core-reference/src/main/java-all/org/apache/syncope/fit/core/reference/flowable/AssignDirectorGroup.java b/fit/core-reference/src/main/java-all/org/apache/syncope/fit/core/reference/flowable/AssignDirectorGroup.java index 523385c6aec..f2b9e0e9d6d 100644 --- a/fit/core-reference/src/main/java-all/org/apache/syncope/fit/core/reference/flowable/AssignDirectorGroup.java +++ b/fit/core-reference/src/main/java-all/org/apache/syncope/fit/core/reference/flowable/AssignDirectorGroup.java @@ -59,7 +59,7 @@ protected void doExecute(final DelegateExecution execution) { execution.setVariable(FlowableRuntimeUtils.PROP_BY_RESOURCE, propInfo.getLeft()); execution.setVariable(FlowableRuntimeUtils.PROP_BY_LINKEDACCOUNT, propInfo.getRight()); } else { - LOG.info("Second level was not approved, not assigning the director group to " + user.getUsername()); + LOG.info("Second level was not approved, not assigning the director group to {}", user.getUsername()); } } } diff --git a/fit/core-reference/src/main/java-all/org/apache/syncope/fit/core/reference/flowable/CreateARelationship.java b/fit/core-reference/src/main/java-all/org/apache/syncope/fit/core/reference/flowable/CreateARelationship.java index cfd3e409488..07a169158af 100644 --- a/fit/core-reference/src/main/java-all/org/apache/syncope/fit/core/reference/flowable/CreateARelationship.java +++ b/fit/core-reference/src/main/java-all/org/apache/syncope/fit/core/reference/flowable/CreateARelationship.java @@ -64,7 +64,7 @@ protected void doExecute(final DelegateExecution execution) { execution.setVariable(FlowableRuntimeUtils.PROP_BY_RESOURCE, propInfo.getLeft()); execution.setVariable(FlowableRuntimeUtils.PROP_BY_LINKEDACCOUNT, propInfo.getRight()); } else { - LOG.info("Printer assignment to " + user.getUsername() + " was not approved"); + LOG.info("Printer assignment to {} was not approved", user.getUsername()); } } } diff --git a/wa/starter/src/main/java/org/apache/syncope/wa/starter/oidc/WAOIDCJWKSGeneratorService.java b/wa/starter/src/main/java/org/apache/syncope/wa/starter/oidc/WAOIDCJWKSGeneratorService.java index 7293ac5148e..5ba8bcf5ed3 100644 --- a/wa/starter/src/main/java/org/apache/syncope/wa/starter/oidc/WAOIDCJWKSGeneratorService.java +++ b/wa/starter/src/main/java/org/apache/syncope/wa/starter/oidc/WAOIDCJWKSGeneratorService.java @@ -80,8 +80,7 @@ public Resource generate() { jwksTO = service.get(); } catch (SyncopeClientException e) { if (e.getType() == ClientExceptionType.NotFound) { - try { - Response response = service.generate(jwksKeyId, jwksType, jwksKeySize); + try (Response response = service.generate(jwksKeyId, jwksType, jwksKeySize)) { jwksTO = response.readEntity(OIDCJWKSTO.class); } catch (Exception ge) { LOG.error("While generating new OIDC JWKS", ge);