-
Notifications
You must be signed in to change notification settings - Fork 55
Closed
Labels
bugThis issue is a bug.This issue is a bug.closed-for-stalenessp2This is a standard priority issueThis is a standard priority issueresponse-requestedWaiting on additional info and feedback. Will move to 'closing-soon' in 5 days.Waiting on additional info and feedback. Will move to 'closing-soon' in 5 days.
Description
Describe the bug
private fun throwHeadObjectError(context: ExecutionContext, call: HttpCall, payload: ByteArray?): kotlin.Nothing {
val wrappedResponse = call.response.withPayload(payload)
val wrappedCall = call.copy(response = wrappedResponse)
val errorDetails = try {
if (payload == null) {
if (call.response.status == HttpStatusCode.NotFound) {
S3ErrorDetails(code = "NotFound")
} else {
S3ErrorDetails(code = call.response.status.toString())
}
} else {
parseS3ErrorResponse(payload)
}
} catch (ex: Exception) {
throw S3Exception("Failed to parse response as restXml error").also {
setS3ErrorMetadata(it, wrappedCall.response, null)
}
}
val ex = when(errorDetails.code) {
"NotFound" -> NotFoundDeserializer().deserialize(context, wrappedCall, payload)
else -> S3Exception(errorDetails.message)
}
setS3ErrorMetadata(ex, wrappedResponse, errorDetails)
throw ex
}Regression Issue
- Select this option if this issue appears to be a regression.
Expected behavior
must throws NotFound exception when receive status 404
Current behavior
when receive status 404, sometimes payload is not null but empty.
when payload is not null, try to parse payload then throw S3Exception("Failed to parse response as restXml error")
Steps to Reproduce
head object from removed object
Possible Solution
No response
Context
No response
AWS SDK for Kotlin version
aws.sdk.kotlin:s3:1.3.70
Platform (JVM/JS/Native)
JVM
Operating system and version
Windows 11
Metadata
Metadata
Assignees
Labels
bugThis issue is a bug.This issue is a bug.closed-for-stalenessp2This is a standard priority issueThis is a standard priority issueresponse-requestedWaiting on additional info and feedback. Will move to 'closing-soon' in 5 days.Waiting on additional info and feedback. Will move to 'closing-soon' in 5 days.