Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
be54320
feat(sdk): add linter and fix linter findings
rubenhoenle Sep 23, 2025
7a3fb20
adapt pmd commentsize
Benjosh95 Oct 9, 2025
700e032
apply make fmt
Benjosh95 Oct 9, 2025
5dff990
shorten deprecated comments
Benjosh95 Oct 9, 2025
7670547
fix commentDefaultAccessModifier
Benjosh95 Oct 9, 2025
bcf629a
fix pmd ImmutableField
Benjosh95 Oct 9, 2025
2e0f841
fix pmd AvoidUncheckedExceptionsInSignatures
Benjosh95 Oct 9, 2025
dc61aa0
fix pmd AvoidThrowingRawExceptionTypes
Benjosh95 Oct 9, 2025
fba3469
fix pmd avoidsynchronized statement or method
Benjosh95 Oct 9, 2025
62c44e0
fix pmd law-of-demeter in ruleset
Benjosh95 Oct 9, 2025
d7aec54
fix pmd GuardLogStatement
Benjosh95 Oct 9, 2025
c6b1de5
fix pmd commentsize
Benjosh95 Oct 9, 2025
92c9c3f
fix pmd SystemPrintln
Benjosh95 Oct 9, 2025
4c988e1
fix pmd commentsize
Benjosh95 Oct 9, 2025
26134b3
fix pmd commentsize
Benjosh95 Oct 9, 2025
c1f8862
fix pmd systemprintln, guardlogstatement
Benjosh95 Oct 9, 2025
071954b
fix pmd AvoidThrowingRawExceptionTypes
Benjosh95 Oct 9, 2025
03f6849
fix pmd NPathComplexity
Benjosh95 Oct 9, 2025
0eaef38
rework fix pmd systemprintln, guardlogstatement
Benjosh95 Oct 9, 2025
53176a3
fix pmd AvoidThrowingRawExceptionTypes
Benjosh95 Oct 9, 2025
10a0662
fix pmd UseUtilityClass
Benjosh95 Oct 9, 2025
a9cc5bc
fix pmd useutilityclass, refactor example class modifiers
Benjosh95 Oct 9, 2025
8330da9
fix pms useutilityclass classlevel
Benjosh95 Oct 9, 2025
75ccc27
apply make fmt
Benjosh95 Oct 9, 2025
f4e40c8
update ci pipeline to include new linter
Benjosh95 Oct 9, 2025
245233d
remove comments
Benjosh95 Oct 14, 2025
ddb2f62
remove pmd utilityclass, add priv. constructors
Benjosh95 Oct 14, 2025
05d29e0
remove some pmd NPathComplexity
Benjosh95 Oct 14, 2025
52951fe
add exception for authentication related issues
Benjosh95 Oct 23, 2025
66a8b67
add exception for example/sdk related issues
Benjosh95 Oct 23, 2025
e9e2555
fix format
Benjosh95 Oct 23, 2025
f367752
add proper serialVersionUID
Benjosh95 Oct 23, 2025
6d6032d
update changelogs and version
Benjosh95 Oct 23, 2025
858a3fb
suppress example runtimeException, update changelogs
Benjosh95 Oct 24, 2025
c00c55d
fix fmt
Benjosh95 Oct 24, 2025
f7e72cb
fix duplicate warning and parameter typo
Benjosh95 Oct 24, 2025
469106a
undo fix of config typo
Benjosh95 Oct 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import cloud.stackit.sdk.core.config.CoreConfiguration;
import cloud.stackit.sdk.core.config.EnvironmentVariables;
import cloud.stackit.sdk.core.exception.ApiException;
import cloud.stackit.sdk.core.exception.AuthenticationException;
import cloud.stackit.sdk.core.model.ServiceAccountKey;
import cloud.stackit.sdk.core.utils.Utils;
import com.auth0.jwt.JWT;
Expand Down Expand Up @@ -132,7 +133,7 @@ public Request authenticate(Route route, @NotNull Response response) throws IOEx
try {
accessToken = getAccessToken();
} catch (ApiException | InvalidKeySpecException e) {
throw new IllegalStateException(e);
throw new AuthenticationException("Failed to obtain access token", e);
}

// Return a new request with the refreshed token
Expand Down Expand Up @@ -215,7 +216,7 @@ protected void createAccessToken() throws InvalidKeySpecException, IOException,
try {
assertion = generateSelfSignedJWT();
} catch (NoSuchAlgorithmException e) {
throw new IllegalStateException(
throw new AuthenticationException(
"could not find required algorithm for jwt signing. This should not happen and should be reported on https://github.com/stackitcloud/stackit-sdk-java/issues",
e);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cloud.stackit.sdk.core;

import cloud.stackit.sdk.core.exception.ApiException;
import cloud.stackit.sdk.core.exception.AuthenticationException;
import java.io.IOException;
import java.security.spec.InvalidKeySpecException;
import okhttp3.Interceptor;
Expand Down Expand Up @@ -37,7 +38,7 @@ public Response intercept(Chain chain) throws IOException {
} catch (InvalidKeySpecException | ApiException e) {
// try-catch required, because ApiException can not be thrown in the implementation
// of Interceptor.intercept(Chain chain)
throw new IllegalStateException(e);
throw new AuthenticationException("Failed to obtain access token for request authentication", e);
}

Request authenticatedRequest =
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package cloud.stackit.sdk.core.exception;

/**
* Exception thrown when authentication operations fail.
* This includes token generation, refresh, and validation failures.
*/
public class AuthenticationException extends RuntimeException {
private static final long serialVersionUID = 1L;

/**
* Constructs a new AuthenticationException with the specified detail message.
*
* @param message the detail message
*/
public AuthenticationException(String message) {
super(message);
}

/**
* Constructs a new AuthenticationException with the specified detail message and cause.
*
* @param message the detail message
* @param cause the cause of this exception
*/
public AuthenticationException(String message, Throwable cause) {
super(message, cause);
}

/**
* Constructs a new AuthenticationException with the specified cause.
*
* @param cause the cause of this exception
*/
public AuthenticationException(Throwable cause) {
super(cause);
}
}