Skip to content

Commit

Permalink
Addressing residual deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
ilgrosso committed Sep 15, 2023
1 parent f84e6e5 commit a816d62
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 + "')")
Expand Down Expand Up @@ -490,8 +488,7 @@ protected List<ProvisioningReport> pull(
List<ProvisioningReport> 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,
Expand Down Expand Up @@ -679,8 +676,7 @@ public List<ProvisioningReport> 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,
Expand Down Expand Up @@ -729,8 +725,7 @@ public List<ProvisioningReport> 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;

public final class URIUtils {

Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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;
Expand Down

0 comments on commit a816d62

Please sign in to comment.