From d564bb3ee251b48ecbc7755f016a2b7d3da6ef0c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Dec 2024 04:53:43 +0000 Subject: [PATCH 1/2] Bump org.gaul:modernizer-maven-plugin from 2.9.0 to 3.0.0 Bumps [org.gaul:modernizer-maven-plugin](https://github.com/gaul/modernizer-maven-plugin) from 2.9.0 to 3.0.0. - [Release notes](https://github.com/gaul/modernizer-maven-plugin/releases) - [Commits](https://github.com/gaul/modernizer-maven-plugin/compare/modernizer-maven-plugin-2.9.0...modernizer-maven-plugin-3.0.0) --- updated-dependencies: - dependency-name: org.gaul:modernizer-maven-plugin dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6e62492..6786d25 100644 --- a/pom.xml +++ b/pom.xml @@ -234,7 +234,7 @@ org.gaul modernizer-maven-plugin - 2.9.0 + 3.0.0 ${targetJdk} From d4dd52ea6352d965931db51ddf1d9f24700c34a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francesco=20Chicchiricc=C3=B2?= Date: Mon, 30 Dec 2024 08:05:45 +0100 Subject: [PATCH 2/2] Comply with modernizer --- .../CredentialsGeneratorApplication.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/tirasa/connid/bundles/googleapps/credentialsgenerator/CredentialsGeneratorApplication.java b/src/main/java/net/tirasa/connid/bundles/googleapps/credentialsgenerator/CredentialsGeneratorApplication.java index 1b9b397..745b783 100644 --- a/src/main/java/net/tirasa/connid/bundles/googleapps/credentialsgenerator/CredentialsGeneratorApplication.java +++ b/src/main/java/net/tirasa/connid/bundles/googleapps/credentialsgenerator/CredentialsGeneratorApplication.java @@ -29,11 +29,12 @@ import com.google.api.client.json.JsonFactory; import com.google.api.client.json.gson.GsonFactory; import java.awt.Desktop; -import java.io.File; -import java.io.FileReader; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.Arrays; import java.util.LinkedHashMap; import java.util.List; @@ -101,8 +102,8 @@ public static void main(final String[] args) { sa.run(args); } - private void getConfigurationMap(final File clientJson) throws IOException, URISyntaxException { - GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, new FileReader(clientJson)); + private void getConfigurationMap(final Path clientJson) throws IOException, URISyntaxException { + GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, Files.newBufferedReader(clientJson)); CONFIG_MAP.put("clientId", clientSecrets.getDetails().getClientId()); CONFIG_MAP.put("clientSecret", clientSecrets.getDetails().getClientSecret()); @@ -142,12 +143,12 @@ public ServletRegistrationBean codeProcessorServlet() { @Override public void run(final String... args) throws IOException, URISyntaxException { if (args.length == 1) { - File clientJson = new File(args[0]); - if (clientJson.isDirectory()) { - clientJson = new File(clientJson, CLIENTSECRETS_LOCATION); + Path clientJson = Paths.get(args[0]); + if (Files.isDirectory(clientJson)) { + clientJson = clientJson.resolve(CLIENTSECRETS_LOCATION); } - if (clientJson.exists() && clientJson.isFile()) { + if (Files.isReadable(clientJson) && Files.isRegularFile(clientJson)) { getConfigurationMap(clientJson); } else { LOG.error("Invalid client secret path: {}", clientJson);