Skip to content

Commit 0aaf0f3

Browse files
authored
chore: minor cleanup to address warnings (#293)
1 parent 4b998c6 commit 0aaf0f3

File tree

3 files changed

+3
-3
lines changed
  • aws-runtime/protocols/http/common/test/aws/sdk/kotlin/runtime/http/middleware
  • codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen
  • examples/dynamodb-movies/src/main/kotlin/aws/sdk/kotlin/example

3 files changed

+3
-3
lines changed

aws-runtime/protocols/http/common/test/aws/sdk/kotlin/runtime/http/middleware/UserAgentTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import kotlin.test.assertTrue
2626
class UserAgentTest {
2727

2828
@Test
29-
fun `it sets ua headers`() = runSuspendTest {
29+
fun itSetsUAHeaders() = runSuspendTest {
3030
val mockEngine = object : HttpClientEngineBase("test") {
3131
override suspend fun roundTrip(request: HttpRequest): HttpCall {
3232
val resp = HttpResponse(HttpStatusCode.fromValue(200), Headers.Empty, HttpBody.Empty)

codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/AwsKotlinDependency.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const val AWS_CLIENT_RT_REGIONS_NS = "aws.sdk.kotlin.runtime.regions"
1717
private fun getDefaultRuntimeVersion(): String {
1818
// generated as part of the build, see smithy-aws-kotlin-codegen/build.gradle.kts
1919
try {
20-
val version = object {}.javaClass.getResource("sdk-version.txt").readText()
20+
val version = object {}.javaClass.getResource("sdk-version.txt")?.readText() ?: throw CodegenException("sdk-version.txt does not exist")
2121
check(isValidVersion(version)) { "Version parsed from sdk-version.txt '$version' is not a valid version string" }
2222
return version
2323
} catch (ex: Exception) {

examples/dynamodb-movies/src/main/kotlin/aws/sdk/kotlin/example/Main.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ suspend fun DynamoDbClient.moviesInYear(name: String, year: Int): QueryResponse
131131
// utility/support functions
132132

133133
fun getResourceAsText(path: String): String =
134-
object {}.javaClass.getResource(path).readText()
134+
object {}.javaClass.getResource(path)?.readText() ?: error("Unable to load $path")
135135

136136
// map json to attribute values
137137
fun jsonElementToAttributeValue(element: JsonElement): AttributeValue = when {

0 commit comments

Comments
 (0)