diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54b91e0..1f543f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [ 11, 17 ] + java: [ 21 ] name: Java ${{ matrix.java }} steps: - name: Check out code diff --git a/README.md b/README.md index 456c3c5..bfd063c 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ FDSM is _the_ developer's Swiss Army Knife for working with a [Fidesmo device](h # Getting started You will need the following: -- Latest [Java 11](https://adoptopenjdk.net/) for running the app +- Latest [Java 21](https://adoptopenjdk.net/) for running the app - a [Fidesmo Developer account](https://fidesmo.com/book-demo/) for your `$FIDESMO_AUTH` token and `$FIDESMO_APPID` - a Fidesmo device (get one from the [shop](http://shop.fidesmo.com)) - a [PC/SC NFC reader](https://github.com/fidesmo/fdsm/wiki/Choosing-a-desktop-reader) diff --git a/library/pom.xml b/library/pom.xml index b8f4a2a..424f746 100644 --- a/library/pom.xml +++ b/library/pom.xml @@ -7,7 +7,7 @@ com.fidesmo fdsm-toolbox - 25.02.15-SNAPSHOT + 25.11.25-SNAPSHOT fdsm diff --git a/library/src/main/java/com/fidesmo/fdsm/ClientAuthentication.java b/library/src/main/java/com/fidesmo/fdsm/ClientAuthentication.java index 4eb0ed3..4dc77c2 100644 --- a/library/src/main/java/com/fidesmo/fdsm/ClientAuthentication.java +++ b/library/src/main/java/com/fidesmo/fdsm/ClientAuthentication.java @@ -29,9 +29,6 @@ public class ClientAuthentication { private final String authentication; private ClientAuthentication(String auth) { - if (auth.split(":").length > 2) { - throw new IllegalArgumentException("Wrong authentication format"); - } this.authentication = auth; } @@ -47,6 +44,9 @@ public Optional getUsername() { } public static ClientAuthentication forToken(String token) { + if (token.split(":").length > 2) { + throw new IllegalArgumentException("Wrong authentication format"); + } return new ClientAuthentication(token); } diff --git a/library/src/main/java/com/fidesmo/fdsm/ClientInfo.java b/library/src/main/java/com/fidesmo/fdsm/ClientInfo.java index a2623e5..d342e3b 100644 --- a/library/src/main/java/com/fidesmo/fdsm/ClientInfo.java +++ b/library/src/main/java/com/fidesmo/fdsm/ClientInfo.java @@ -34,14 +34,14 @@ public static String stringify(Capability c) { private Set capabilities; private Locale locale; - public ClientInfo(String name, String version, Set capabilities, Locale locale) { + private ClientInfo(String name, String version, Set capabilities, Locale locale) { this.name = name; this.version = version; this.capabilities = Collections.unmodifiableSet(capabilities); this.locale = locale; } - public ClientInfo(String name, String version) { + private ClientInfo(String name, String version) { this(name, version, DEFAULT_CAPABILITIES, Locale.getDefault()); } diff --git a/library/src/main/java/com/fidesmo/fdsm/FidesmoCard.java b/library/src/main/java/com/fidesmo/fdsm/FidesmoCard.java index 21b082c..036104b 100644 --- a/library/src/main/java/com/fidesmo/fdsm/FidesmoCard.java +++ b/library/src/main/java/com/fidesmo/fdsm/FidesmoCard.java @@ -149,8 +149,7 @@ public static Optional detectPlatform(byte[] cplc) { /** Indicates that device is fully batched or requires batching operation otherwise */ private final boolean batched; - public FidesmoCard(byte[] fid, byte[] cplc, int batchId, boolean batched, Optional uid) { - if (fid == null) throw new NullPointerException("fid can't be null"); + private FidesmoCard(byte[] fid, byte[] cplc, int batchId, boolean batched, Optional uid) { this.cin = fid.clone(); this.cplc = cplc == null ? null : cplc.clone(); this.batchId = batchId; @@ -295,7 +294,8 @@ public static Optional detect(Map commands, Fides return Optional.empty(); } } - + + if (cin == null) throw new NullPointerException("fid can't be null"); return Optional.of(new FidesmoCard(cin, cplc, new BigInteger(1, batch).intValue(), true, uid)); } diff --git a/pom.xml b/pom.xml index 9eb846b..b0c7796 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.fidesmo fdsm-toolbox - 25.02.15-SNAPSHOT + 25.11.25-SNAPSHOT pom UTF-8 @@ -145,8 +145,8 @@ 3.8.6 - 11 - ATTENTION: please use JDK11 or later + 21 + ATTENTION: please use JDK21 or later @@ -159,7 +159,7 @@ maven-compiler-plugin 3.10.1 - 11 + 21 -Xlint -Werror @@ -170,7 +170,7 @@ com.github.spotbugs spotbugs-maven-plugin - 4.7.3.0 + 4.9.8.0 spotbugs.xml diff --git a/tool/pom.xml b/tool/pom.xml index 7d9256a..3fa5a7c 100644 --- a/tool/pom.xml +++ b/tool/pom.xml @@ -7,7 +7,7 @@ com.fidesmo fdsm-toolbox - 25.02.15-SNAPSHOT + 25.11.25-SNAPSHOT fdsm-tool @@ -83,7 +83,7 @@ %JAVA_HOME%;%PATH% - 11.0 + 21.0 ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${parsedVersion.buildNumber} diff --git a/tool/src/main/java/com/fidesmo/fdsm/CommandLineInterface.java b/tool/src/main/java/com/fidesmo/fdsm/CommandLineInterface.java index af956cd..fc465af 100644 --- a/tool/src/main/java/com/fidesmo/fdsm/CommandLineInterface.java +++ b/tool/src/main/java/com/fidesmo/fdsm/CommandLineInterface.java @@ -31,7 +31,8 @@ import java.io.IOException; import java.io.PrintStream; import java.net.MalformedURLException; -import java.net.URL; +import java.net.URI; +import java.net.URISyntaxException; import java.util.Arrays; import java.util.List; import java.util.Locale; @@ -114,8 +115,8 @@ protected static void inspectEnvironment(OptionSet args) { // API URL try { - apiurl = new URL(System.getenv().getOrDefault(ENV_FIDESMO_API_URL, FidesmoApiClient.APIv3)).toString(); - } catch (MalformedURLException e) { + apiurl = new URI(System.getenv().getOrDefault(ENV_FIDESMO_API_URL, FidesmoApiClient.APIv3)).toURL().toString(); + } catch (MalformedURLException | URISyntaxException e) { System.err.printf("Invalid $%s: %s%n", ENV_FIDESMO_API_URL, System.getenv(ENV_FIDESMO_API_URL)); } }