Skip to content

Commit 858a3fb

Browse files
committed
suppress example runtimeException, update changelogs
1 parent 6d6032d commit 858a3fb

File tree

7 files changed

+11
-53
lines changed

7 files changed

+11
-53
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
- `core`: [v0.3.0](core/CHANGELOG.md#v030)
33
- **Feature:** New exception types for better error handling
44
- `AuthenticationException`: New exception for authentication-related failures (token generation, refresh, validation)
5-
- `SdkException`: New exception for general SDK operation failures (API calls, network issues)
65

76
## Release (2025-09-30)
87
- `core`: [v0.2.0](core/CHANGELOG.md#v020)

core/CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
## v0.3.0
22
- **Feature:** New exception types for better error handling
33
- `AuthenticationException`: New exception for authentication-related failures (token generation, refresh, validation)
4-
- `SdkException`: New exception for general SDK operation failures (API calls, network issues)
54

65
## v0.2.0
76
- **Feature:** Support for passing custom OkHttpClient objects

core/src/main/java/cloud/stackit/sdk/core/exception/SdkException.java

Lines changed: 0 additions & 37 deletions
This file was deleted.

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import cloud.stackit.sdk.core.config.CoreConfiguration;
44
import cloud.stackit.sdk.core.exception.ApiException;
5-
import cloud.stackit.sdk.core.exception.SdkException;
65
import cloud.stackit.sdk.resourcemanager.api.ResourceManagerApi;
76
import cloud.stackit.sdk.resourcemanager.model.ListOrganizationsResponse;
87
import java.io.File;
@@ -18,7 +17,7 @@ final class AuthenticationExample {
1817

1918
private AuthenticationExample() {}
2019

21-
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.SystemPrintln"})
20+
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.SystemPrintln", "PMD.AvoidThrowingRawExceptionTypes"})
2221
public static void main(String[] args) throws IOException {
2322
/* OPTION 1: setting the paths to service account key (and private key) as configuration */
2423
try {
@@ -35,7 +34,7 @@ public static void main(String[] args) throws IOException {
3534

3635
System.out.println(response.toString());
3736
} catch (ApiException | IOException e) {
38-
throw new SdkException(e);
37+
throw new RuntimeException(e);
3938
}
4039

4140
/*
@@ -89,7 +88,7 @@ public static void main(String[] args) throws IOException {
8988

9089
System.out.println(response.toString());
9190
} catch (ApiException | IOException e) {
92-
throw new SdkException(e);
91+
throw new RuntimeException(e);
9392
}
9493

9594
/*
@@ -126,7 +125,7 @@ public static void main(String[] args) throws IOException {
126125

127126
System.out.println(response.toString());
128127
} catch (ApiException | IOException e) {
129-
throw new SdkException(e);
128+
throw new RuntimeException(e);
130129
}
131130
}
132131
}

examples/custom-http-client/src/main/java/cloud/stackit/sdk/customhttpclient/examples/CustomHttpClientExample.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import cloud.stackit.sdk.core.KeyFlowAuthenticator;
44
import cloud.stackit.sdk.core.config.CoreConfiguration;
55
import cloud.stackit.sdk.core.exception.ApiException;
6-
import cloud.stackit.sdk.core.exception.SdkException;
76
import cloud.stackit.sdk.iaas.api.IaasApi;
87
import cloud.stackit.sdk.iaas.model.*;
98
import java.io.IOException;
@@ -26,7 +25,7 @@ final class CustomHttpClientExample {
2625

2726
private CustomHttpClientExample() {}
2827

29-
@SuppressWarnings("PMD.SystemPrintln")
28+
@SuppressWarnings({"PMD.SystemPrintln", "PMD.AvoidThrowingRawExceptionTypes"})
3029
public static void main(String[] args) throws IOException {
3130
// Credentials are read from the credentialsFile in `~/.stackit/credentials.json` or the env
3231
// STACKIT_SERVICE_ACCOUNT_KEY_PATH / STACKIT_SERVICE_ACCOUNT_KEY
@@ -55,7 +54,7 @@ public static void main(String[] args) throws IOException {
5554
System.out.println("* " + server.getId() + " | " + server.getName());
5655
}
5756
} catch (ApiException e) {
58-
throw new SdkException(e);
57+
throw new RuntimeException(e);
5958
}
6059
}
6160
}

examples/iaas/src/main/java/cloud/stackit/sdk/iaas/examples/IaaSExample.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package cloud.stackit.sdk.iaas.examples;
22

33
import cloud.stackit.sdk.core.exception.ApiException;
4-
import cloud.stackit.sdk.core.exception.SdkException;
54
import cloud.stackit.sdk.iaas.api.IaasApi;
65
import cloud.stackit.sdk.iaas.model.*;
76
import java.io.IOException;
@@ -20,7 +19,8 @@ private IaaSExample() {}
2019
"PMD.CognitiveComplexity",
2120
"PMD.NPathComplexity",
2221
"PMD.NcssCount",
23-
"PMD.SystemPrintln"
22+
"PMD.SystemPrintln",
23+
"PMD.AvoidThrowingRawExceptionTypes"
2424
})
2525
public static void main(String[] args) throws IOException {
2626
/*
@@ -291,7 +291,7 @@ public static void main(String[] args) throws IOException {
291291
System.out.println("Deleted network: " + newNetwork.getNetworkId());
292292

293293
} catch (ApiException | InterruptedException e) {
294-
throw new SdkException(e);
294+
throw new RuntimeException(e);
295295
}
296296
}
297297
}

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package cloud.stackit.sdk.resourcemanager.examples;
22

33
import cloud.stackit.sdk.core.exception.ApiException;
4-
import cloud.stackit.sdk.core.exception.SdkException;
54
import cloud.stackit.sdk.resourcemanager.api.ResourceManagerApi;
65
import cloud.stackit.sdk.resourcemanager.model.CreateFolderPayload;
76
import cloud.stackit.sdk.resourcemanager.model.CreateProjectPayload;
@@ -22,7 +21,7 @@ final class ResourcemanagerExample {
2221

2322
private ResourcemanagerExample() {}
2423

25-
@SuppressWarnings({"PMD.SystemPrintln"})
24+
@SuppressWarnings({"PMD.SystemPrintln", "PMD.AvoidThrowingRawExceptionTypes"})
2625
public static void main(String[] args) throws IOException {
2726
// Credentials are read from the credentialsFile in `~/.stackit/credentials.json` or the env
2827
// STACKIT_SERVICE_ACCOUNT_KEY_PATH / STACKIT_SERVICE_ACCOUNT_KEY
@@ -113,7 +112,7 @@ public static void main(String[] args) throws IOException {
113112
/* delete folder */
114113
resourceManagerApi.deleteFolder(folder.getContainerId(), true);
115114
} catch (ApiException e) {
116-
throw new SdkException(e);
115+
throw new RuntimeException(e);
117116
}
118117
}
119118
}

0 commit comments

Comments
 (0)