Skip to content

Commit dc61aa0

Browse files
committed
fix pmd AvoidThrowingRawExceptionTypes
1 parent 2e0f841 commit dc61aa0

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public Request authenticate(Route route, @NotNull Response response) throws IOEx
134134
try {
135135
accessToken = getAccessToken();
136136
} catch (ApiException | InvalidKeySpecException e) {
137-
throw new RuntimeException(e);
137+
throw new IllegalStateException(e);
138138
}
139139

140140
// Return a new request with the refreshed token
@@ -220,7 +220,7 @@ protected void createAccessToken()
220220
try {
221221
assertion = generateSelfSignedJWT();
222222
} catch (NoSuchAlgorithmException e) {
223-
throw new RuntimeException(
223+
throw new IllegalStateException(
224224
"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",
225225
e);
226226
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public Response intercept(Chain chain) throws IOException {
3737
} catch (InvalidKeySpecException | ApiException e) {
3838
// try-catch required, because ApiException can not be thrown in the implementation
3939
// of Interceptor.intercept(Chain chain)
40-
throw new RuntimeException(e);
40+
throw new IllegalStateException(e);
4141
}
4242

4343
Request authenticatedRequest =

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
@@ -80,7 +80,7 @@ public void init() throws IOException {
8080
@Deprecated
8181
public Interceptor getAuthHandler() {
8282
if (authHandler == null) {
83-
throw new RuntimeException("init() has to be called first");
83+
throw new IllegalStateException("init() has to be called first");
8484
}
8585
return authHandler;
8686
}

0 commit comments

Comments
 (0)