diff --git a/core/idm/logic/src/main/java/org/apache/syncope/core/logic/ReconciliationLogic.java b/core/idm/logic/src/main/java/org/apache/syncope/core/logic/ReconciliationLogic.java index 691233a77a..af9678339d 100644 --- a/core/idm/logic/src/main/java/org/apache/syncope/core/logic/ReconciliationLogic.java +++ b/core/idm/logic/src/main/java/org/apache/syncope/core/logic/ReconciliationLogic.java @@ -106,7 +106,6 @@ import org.identityconnectors.framework.common.objects.filter.Filter; import org.identityconnectors.framework.spi.SearchResultsHandler; import org.quartz.JobExecutionException; -import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.transaction.annotation.Transactional; @@ -376,8 +375,7 @@ public ReconStatus status( } protected SyncopeSinglePushExecutor singlePushExecutor() { - return (SyncopeSinglePushExecutor) ApplicationContextProvider.getBeanFactory(). - createBean(SinglePushJobDelegate.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME, false); + return ApplicationContextProvider.getBeanFactory().createBean(SinglePushJobDelegate.class); } @PreAuthorize("hasRole('" + IdRepoEntitlement.TASK_EXECUTE + "')") @@ -490,8 +488,7 @@ protected List pull( List results = new ArrayList<>(); try { SyncopeSinglePullExecutor executor = - (SyncopeSinglePullExecutor) ApplicationContextProvider.getBeanFactory(). - createBean(SinglePullJobDelegate.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME, false); + ApplicationContextProvider.getBeanFactory().createBean(SinglePullJobDelegate.class); results.addAll(executor.pull( resource, @@ -679,8 +676,7 @@ public List push( columns.toArray(String[]::new))) { SyncopeStreamPushExecutor executor = - (SyncopeStreamPushExecutor) ApplicationContextProvider.getBeanFactory(). - createBean(StreamPushJobDelegate.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME, false); + ApplicationContextProvider.getBeanFactory().createBean(StreamPushJobDelegate.class); return executor.push( anyType, matching, @@ -729,8 +725,7 @@ public List pull(final CSVPullSpec spec, final InputStream c } SyncopeStreamPullExecutor executor = - (SyncopeStreamPullExecutor) ApplicationContextProvider.getBeanFactory(). - createBean(StreamPullJobDelegate.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME, false); + ApplicationContextProvider.getBeanFactory().createBean(StreamPullJobDelegate.class); return executor.pull(anyType, spec.getKeyColumn(), columns, diff --git a/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/ReportLogicTest.java b/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/ReportLogicTest.java index 463527ac03..71e51bd87e 100644 --- a/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/ReportLogicTest.java +++ b/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/ReportLogicTest.java @@ -46,7 +46,6 @@ import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.context.SecurityContextHolder; @@ -120,8 +119,8 @@ public void executeAndExport() throws Exception { JobExecutionContext ctx = mock(JobExecutionContext.class); when(ctx.getMergedJobDataMap()).thenReturn(jobDataMap); - ReportJobDelegate delegate = (ReportJobDelegate) ApplicationContextProvider.getBeanFactory(). - createBean(TestReportJobDelegate.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME, false); + ReportJobDelegate delegate = + ApplicationContextProvider.getBeanFactory().createBean(TestReportJobDelegate.class); delegate.execute(report.getKey(), false, ctx); report = logic.read(report.getKey()); diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/attrvalue/validation/URLValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/attrvalue/validation/URLValidator.java index acb8f6b9b0..630eee9461 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/attrvalue/validation/URLValidator.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/attrvalue/validation/URLValidator.java @@ -18,8 +18,7 @@ */ package org.apache.syncope.core.persistence.jpa.attrvalue.validation; -import java.net.MalformedURLException; -import java.net.URL; +import java.net.URI; import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidPlainAttrValueException; import org.apache.syncope.core.persistence.api.entity.PlainAttrValue; import org.apache.syncope.core.persistence.api.entity.PlainSchema; @@ -31,8 +30,8 @@ public class URLValidator extends AbstractValidator { @Override protected void doValidate(final PlainSchema schema, final PlainAttrValue attrValue) { try { - new URL(attrValue.getStringValue()); - } catch (MalformedURLException e) { + new URI(attrValue.getStringValue()).toURL(); + } catch (Exception e) { throw new InvalidPlainAttrValueException("\"" + attrValue.getValue() + "\" is not a valid URL"); } } diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/URIUtils.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/URIUtils.java index 143a14c00d..6a7db47dfd 100644 --- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/URIUtils.java +++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/URIUtils.java @@ -22,7 +22,6 @@ import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; -import java.net.URL; public final class URIUtils { @@ -51,7 +50,7 @@ public static URI buildForConnId(final String location) throws MalformedURLExcep URI uri; if (candidate.startsWith("file:")) { - uri = new File(new URL(candidate).getFile()).getAbsoluteFile().toURI(); + uri = new File(new URI(candidate).toURL().getFile()).getAbsoluteFile().toURI(); } else { uri = new URI(candidate); } diff --git a/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/pushpull/stream/StreamPullJobDelegateTest.java b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/pushpull/stream/StreamPullJobDelegateTest.java index 4fd7afc46c..a412b852b3 100644 --- a/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/pushpull/stream/StreamPullJobDelegateTest.java +++ b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/pushpull/stream/StreamPullJobDelegateTest.java @@ -45,7 +45,6 @@ import org.junit.jupiter.api.Test; import org.quartz.JobExecutionException; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.transaction.annotation.Transactional; @Transactional("Master") @@ -62,8 +61,7 @@ public class StreamPullJobDelegateTest extends AbstractTest { private SyncopeStreamPullExecutor executor() { synchronized (this) { if (executor == null) { - executor = (SyncopeStreamPullExecutor) ApplicationContextProvider.getBeanFactory(). - createBean(StreamPullJobDelegate.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME, false); + executor = ApplicationContextProvider.getBeanFactory().createBean(StreamPullJobDelegate.class); } } return executor; diff --git a/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/pushpull/stream/StreamPushJobDelegateTest.java b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/pushpull/stream/StreamPushJobDelegateTest.java index e1274608dd..9980aa6e71 100644 --- a/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/pushpull/stream/StreamPushJobDelegateTest.java +++ b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/pushpull/stream/StreamPushJobDelegateTest.java @@ -44,7 +44,6 @@ import org.apache.syncope.core.spring.security.AuthContextUtils; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.transaction.annotation.Transactional; @Transactional("Master") @@ -61,8 +60,7 @@ public class StreamPushJobDelegateTest extends AbstractTest { private SyncopeStreamPushExecutor executor() { synchronized (this) { if (executor == null) { - executor = (SyncopeStreamPushExecutor) ApplicationContextProvider.getBeanFactory(). - createBean(StreamPushJobDelegate.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME, false); + executor = ApplicationContextProvider.getBeanFactory().createBean(StreamPushJobDelegate.class); } } return executor;