Handle 200 OK errors in PutObject (multipart) in S3 CRT client#7084
Open
alextwoods wants to merge 1 commit into
Open
Handle 200 OK errors in PutObject (multipart) in S3 CRT client#7084alextwoods wants to merge 1 commit into
alextwoods wants to merge 1 commit into
Conversation
alextwoods
commented
Jun 26, 2026
| // We wrap the response in ErrorFlaggedSdkHttpResponse which overrides isSuccessful() to return false. | ||
| // This causes the downstream SDK pipeline (XmlResponseParserUtils, DecorateErrorFromResponseBodyUnmarshaller) | ||
| // to parse the body and detect the error, producing a properly modeled S3Exception. | ||
| SdkHttpFullResponse errorFlagged = new ErrorFlaggedSdkHttpResponse(errorResponse.build()); |
Contributor
Author
There was a problem hiding this comment.
Naming is hard - My other alternative here was something like "SdkHttpResponse200OkError" or something like that.
alextwoods
commented
Jun 26, 2026
|
|
||
| @BeforeAll | ||
| public static void setUpBeforeAll() { | ||
| System.setProperty("aws.crt.debugnative", "true"); |
Contributor
Author
There was a problem hiding this comment.
zoewangg
approved these changes
Jun 26, 2026
Fred1155
approved these changes
Jun 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Handle 200 OK errors in PutObject (multipart) in S3 CRT client
Motivation and Context
Fixes: #7068
The CRT client already detects 200ok errors during MPU in PutObject, however, they are not correctly handled in our Java code.
The reason the normal handling of 200OK errors does not work for this case is that the 200OK error handling is normally only applied for non-streaming operations. PutObject is a streaming operation, but under the hood, the CRT may do a MPU, and complete multipart upload is not streaming and may respond with a 200 OK error.
Modifications
Wrap the SDK response object in a new
ErrorFlaggedSdkHttpResponsewhich returns false forisSuccessful, causing the SDK's normal error parsing to be used.Note, earlier PR #7071 does correctly raise an exception, but does not parse the code/message from the body. To avoid brining in xml parsing to the CRT handler, this PR wraps the sdk response object and relies on the existing error unmarshalling pipeline.
Testing
New and existing unit tests + ran repro from #7068 to confirm.
Screenshots (if appropriate)
Types of changes
Checklist
mvn installsucceedsscripts/new-changescript and following the instructions. Commit the new file created by the script in.changes/next-releasewith your changes.License