Skip to content

Commit ff65e84

Browse files
Merge branch 'main' into dependabot/gradle/org.junit.jupiter-junit-jupiter-engine-6.0.2
2 parents e1d2eaf + 0eecbd1 commit ff65e84

File tree

15 files changed

+200
-204
lines changed

15 files changed

+200
-204
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
version: [11, 17, 21]
15+
version: [17, 21, 25]
1616
steps:
1717
- name: Checkout
1818
uses: actions/checkout@v6

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ plugins {
55
id 'eclipse'
66
id 'pmd'
77

8-
id 'com.diffplug.spotless' version '6.21.0'
8+
id 'com.diffplug.spotless' version '8.1.0'
99

1010
/* We have to use this 3rd party plugin for publishing to MavenCentral because as of AUG-2025 there is no official
1111
* plugin which supports publishing to MavenCentral Portal. */
12-
id "com.vanniktech.maven.publish.base" version "0.34.0"
12+
id "com.vanniktech.maven.publish.base" version "0.36.0"
1313
}
1414

1515
allprojects {
@@ -69,7 +69,7 @@ allprojects {
6969

7070
pmd {
7171
consoleOutput = true
72-
toolVersion = "7.12.0"
72+
toolVersion = "7.20.0"
7373

7474
// This tells PMD to use your custom ruleset file.
7575
ruleSetFiles = rootProject.files("config/pmd/pmd-ruleset.xml")

core/src/main/java/cloud/stackit/sdk/core/KeyFlowAuthenticator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import java.security.NoSuchAlgorithmException;
2020
import java.security.interfaces.RSAPrivateKey;
2121
import java.security.spec.InvalidKeySpecException;
22-
import java.util.Date;
22+
import java.time.Instant;
2323
import java.util.Map;
2424
import java.util.UUID;
2525
import java.util.concurrent.ConcurrentHashMap;
@@ -200,7 +200,7 @@ public KeyFlowTokenResponse(
200200
}
201201

202202
protected boolean isExpired() {
203-
return expiresIn < new Date().toInstant().getEpochSecond();
203+
return expiresIn < Instant.now().getEpochSecond();
204204
}
205205

206206
protected String getAccessToken() {
@@ -342,8 +342,8 @@ private String generateSelfSignedJWT()
342342
.withSubject(saKey.getCredentials().getSub())
343343
.withJWTId(UUID.randomUUID().toString())
344344
.withAudience(saKey.getCredentials().getAud())
345-
.withIssuedAt(new Date())
346-
.withExpiresAt(new Date().toInstant().plusSeconds(10 * 60))
345+
.withIssuedAt(Instant.now())
346+
.withExpiresAt(Instant.now().plusSeconds(10 * 60))
347347
.withHeader(jwtHeader)
348348
.sign(algorithm);
349349
}

core/src/main/java/cloud/stackit/sdk/core/auth/SetupAuth.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ protected static String readValueFromCredentialsFile(
327327
} catch (ClassCastException ignored) {
328328
}
329329
if (Utils.isStringSet(keyPath)) {
330-
return new String(Files.readAllBytes(Paths.get(keyPath)));
330+
return new String(Files.readAllBytes(Paths.get(keyPath)), StandardCharsets.UTF_8);
331331
}
332332
throw new CredentialsInFileNotFoundException(
333333
"could not find " + valueKey + " or " + pathKey + " in " + path);

examples/alb/src/main/java/cloud/stackit/sdk/alb/examples/AlbExample.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ private AlbExample() {}
1818
"PMD.CognitiveComplexity",
1919
"PMD.CommentSize",
2020
"PMD.CyclomaticComplexity",
21-
"PMD.NPathComplexity",
2221
"PMD.NcssCount",
2322
"PMD.SystemPrintln",
2423
"PMD.AvoidThrowingRawExceptionTypes"

examples/authentication/src/main/java/cloud/stackit/sdk/authentication/examples/AuthenticationExample.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import java.io.File;
88
import java.io.FileNotFoundException;
99
import java.io.IOException;
10+
import java.nio.charset.StandardCharsets;
1011
import java.util.Scanner;
1112

1213
final class AuthenticationExample {
@@ -53,7 +54,7 @@ public static void main(String[] args) throws IOException {
5354
"examples/authentication/src/main/java/cloud/stackit/sdk/authentication/examples/dummy_credentials/dummy-service-account-key.json";
5455
File serviceAccountKeyFile = new File(serviceAccountKeyPath);
5556
StringBuilder serviceAccountKeyContent = new StringBuilder();
56-
try (Scanner myReader = new Scanner(serviceAccountKeyFile)) {
57+
try (Scanner myReader = new Scanner(serviceAccountKeyFile, StandardCharsets.UTF_8.name())) {
5758
while (myReader.hasNextLine()) {
5859
serviceAccountKeyContent.append(myReader.nextLine());
5960
}
@@ -66,7 +67,7 @@ public static void main(String[] args) throws IOException {
6667
"examples/authentication/src/main/java/cloud/stackit/sdk/authentication/examples/dummy_credentials/dummy-private-key.pem";
6768
File privateKeyFile = new File(privateKeyPath);
6869
StringBuilder privateKeyContent = new StringBuilder();
69-
try (Scanner myReader = new Scanner(privateKeyFile)) {
70+
try (Scanner myReader = new Scanner(privateKeyFile, StandardCharsets.UTF_8.name())) {
7071
while (myReader.hasNextLine()) {
7172
privateKeyContent.append(myReader.nextLine());
7273
}

examples/loadbalancer/src/main/java/cloud/stackit/sdk/loadbalancer/examples/LoadBalancerExample.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ private LoadBalancerExample() {}
1818
"PMD.CognitiveComplexity",
1919
"PMD.CommentSize",
2020
"PMD.CyclomaticComplexity",
21-
"PMD.NPathComplexity",
2221
"PMD.NcssCount",
2322
"PMD.SystemPrintln",
2423
"PMD.AvoidThrowingRawExceptionTypes"

examples/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/examples/ObjectStorageExample.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ private ObjectStorageExample() {}
1919

2020
@SuppressWarnings({
2121
"PMD.CyclomaticComplexity",
22-
"PMD.CognitiveComplexity",
23-
"PMD.NPathComplexity",
2422
"PMD.NcssCount",
2523
"PMD.SystemPrintln",
2624
"PMD.AvoidThrowingRawExceptionTypes"

examples/resourcemanager/src/main/java/cloud/stackit/sdk/resourcemanager/examples/ResourcemanagerExample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ final class ResourcemanagerExample {
2424
/** Prevent instantiation */
2525
private ResourcemanagerExample() {}
2626

27-
@SuppressWarnings({"PMD.SystemPrintln", "PMD.AvoidThrowingRawExceptionTypes"})
27+
@SuppressWarnings({"PMD.SystemPrintln"})
2828
public static void main(String[] args)
2929
throws IOException, ApiException, InterruptedException, ExecutionException {
3030
// Credentials are read from the credentialsFile in `~/.stackit/credentials.json` or the env

examples/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/examples/ServerUpdateExample.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ private ServerUpdateExample() {}
2020
@SuppressWarnings({
2121
"PMD.CyclomaticComplexity",
2222
"PMD.CognitiveComplexity",
23-
"PMD.NPathComplexity",
2423
"PMD.NcssCount",
2524
"PMD.SystemPrintln",
2625
"PMD.AvoidThrowingRawExceptionTypes",

0 commit comments

Comments
 (0)