Skip to content

Commit

Permalink
Upgrading modernizer-maven-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
ilgrosso committed Dec 30, 2024
1 parent 5479e3b commit a1a10eb
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Expand All @@ -41,7 +42,7 @@ public final class JavaDocUtils {

private static URL toURL(final String classPathEntry) {
try {
return new File(classPathEntry).toURI().toURL();
return Path.of(classPathEntry).toUri().toURL();
} catch (MalformedURLException e) {
throw new IllegalArgumentException("URL could not be created from '" + classPathEntry + "'", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
*/
package org.apache.syncope.core.persistence.api.utils;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Path;

public final class URIUtils {

Expand Down Expand Up @@ -50,7 +50,7 @@ public static URI buildForConnId(final String location) throws MalformedURLExcep

URI uri;
if (candidate.startsWith("file:")) {
uri = new File(new URI(candidate).toURL().getFile()).getAbsoluteFile().toURI();
uri = Path.of(new URI(candidate)).toAbsolutePath().toFile().toURI();
} else {
uri = new URI(candidate);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

import java.io.File;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -91,7 +91,7 @@ public void findById() {
public void save() throws ClassNotFoundException {
ConnInstance connInstance = entityFactory.newEntity(ConnInstance.class);

connInstance.setLocation(new File(System.getProperty("java.io.tmpdir")).toURI().toString());
connInstance.setLocation(Path.of(System.getProperty("java.io.tmpdir")).toUri().toString());

// set connector version
connInstance.setVersion("1.0");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

import java.io.File;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -91,7 +91,7 @@ public void findById() {
public void save() throws ClassNotFoundException {
ConnInstance connInstance = entityFactory.newEntity(ConnInstance.class);

connInstance.setLocation(new File(System.getProperty("java.io.tmpdir")).toURI().toString());
connInstance.setLocation(Path.of(System.getProperty("java.io.tmpdir")).toUri().toString());

// set connector version
connInstance.setVersion("1.0");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import java.io.File;
import java.net.URI;
import java.nio.file.Path;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Future;
Expand Down Expand Up @@ -539,7 +540,7 @@ private static Object getPropertyValue(final String propType, final List<?> valu
} else if (URI.class.equals(propertySchemaClass)) {
value = URI.create(values.get(0).toString());
} else if (File.class.equals(propertySchemaClass)) {
value = new File(values.get(0).toString());
value = Path.of(values.get(0).toString()).toFile();
} else if (String[].class.equals(propertySchemaClass)) {
value = values.toArray(String[]::new);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.io.IOException;
import java.net.URI;
import java.net.URL;
import java.nio.file.Path;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Collections;
Expand Down Expand Up @@ -82,7 +83,7 @@ public List<URI> getLocations() {

protected void initLocal(final URI location) {
// 1. Find bundles inside local directory
File bundleDirectory = new File(location);
File bundleDirectory = Path.of(location).toFile();
String[] bundleFiles = bundleDirectory.list();
if (bundleFiles == null) {
throw new NotFoundException("Local bundles directory " + location);
Expand All @@ -91,7 +92,7 @@ protected void initLocal(final URI location) {
List<URL> bundleFileURLs = new ArrayList<>();
for (String file : bundleFiles) {
try {
bundleFileURLs.add(IOUtil.makeURL(bundleDirectory, file));
bundleFileURLs.add(IOUtil.makeURL(bundleDirectory.toPath(), file));
} catch (IOException ignore) {
// ignore exception and don't add bundle
LOG.debug("{}/{} is not a valid connector bundle", bundleDirectory.toString(), file, ignore);
Expand Down Expand Up @@ -221,7 +222,7 @@ public Pair<URI, ConnectorInfo> getConnectorInfo(final ConnInstance connInstance

if (LOG.isDebugEnabled()) {
LOG.debug("\nBundle name: {}\nBundle version: {}\nBundle class: {}",
key.getBundleName(), key.getBundleVersion(), key.getConnectorName());
key.getBundleName(), key.getBundleVersion(), key.getConnectorName());
}

// get the specified connector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package org.apache.syncope.fit.core.reference;

import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.util.Set;
import org.apache.syncope.common.lib.types.OpEvent;
Expand Down Expand Up @@ -67,7 +67,7 @@ public void process(final String domain, final AuditEvent event) {
String content = POJOHelper.serialize(auditEventDAO.toAuditEventTO(event)) + '\n';
try {
Files.writeString(
Paths.get(fileName),
Path.of(fileName),
content,
StandardOpenOption.CREATE, StandardOpenOption.APPEND);
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.OffsetDateTime;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -453,8 +452,7 @@ public void auditEventProcessor() throws IOException, InterruptedException {
Properties props = new Properties();
props.load(propStream);

Path auditFilePath = Paths.get(props.getProperty("test.log.dir")
+ File.separator + "audit_for_Master_file");
Path auditFilePath = Path.of(props.getProperty("test.log.dir") + File.separator + "audit_for_Master_file");

// check that resource update is transformed and logged onto an audit file.
ResourceTO resource = RESOURCE_SERVICE.read(RESOURCE_NAME_CSV);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@
import static org.junit.jupiter.api.Assumptions.assumeFalse;

import jakarta.ws.rs.core.Response;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.Collections;
Expand Down Expand Up @@ -282,8 +283,8 @@ public void fromCSV() throws Exception {
try (InputStream propStream = getClass().getResourceAsStream("/test.properties")) {
props.load(propStream);

try (InputStream src = new FileInputStream(props.getProperty("test.csv.src"));
FileOutputStream dst = new FileOutputStream(props.getProperty("test.csv.dst"))) {
try (InputStream src = Files.newInputStream(Path.of(props.getProperty("test.csv.src")));
OutputStream dst = Files.newOutputStream(Path.of(props.getProperty("test.csv.dst")))) {

IOUtils.copy(src, dst);
}
Expand Down
11 changes: 6 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -395,10 +395,10 @@ under the License.
<project.build.outputTimestamp>2024-12-27T11:02:14Z</project.build.outputTimestamp>
<syncope.version>${project.version}</syncope.version>

<connid.version>1.6.0.0-RC3</connid.version>
<connid.soap.version>1.5.0-RC2</connid.soap.version>
<connid.rest.version>1.1.0-RC2</connid.rest.version>
<connid.db.version>2.4.0-RC1</connid.db.version>
<connid.version>1.6.0.0-SNAPSHOT</connid.version>
<connid.soap.version>1.5.0-SNAPSHOT</connid.soap.version>
<connid.rest.version>1.1.0-SNAPSHOT</connid.rest.version>
<connid.db.version>2.4.0-SNAPSHOT</connid.db.version>
<connid.csvdir.version>0.8.9</connid.csvdir.version>
<connid.ldap.version>1.5.9</connid.ldap.version>
<connid.ad.version>1.3.9</connid.ad.version>
Expand Down Expand Up @@ -1752,7 +1752,7 @@ under the License.
<plugin>
<groupId>org.gaul</groupId>
<artifactId>modernizer-maven-plugin</artifactId>
<version>2.9.0</version>
<version>3.0.0</version>
<configuration>
<javaVersion>${targetJdk}</javaVersion>
<ignorePackages>
Expand Down Expand Up @@ -2263,6 +2263,7 @@ under the License.
<ianal.phase>none</ianal.phase>
<modernizer.skip>true</modernizer.skip>
<rat.skip>true</rat.skip>
<modernizer.skip>true</modernizer.skip>
<checkstyle.skip>true</checkstyle.skip>
</properties>

Expand Down

0 comments on commit a1a10eb

Please sign in to comment.