You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I acknowledge the upcoming end-of-support for AWS SDK for Java v1 was announced, and migration to AWS SDK for Java v2 is recommended.
Describe the bug
The method AmazonS3Client::listNextBatchOfObjects(ListNextBatchOfObjectsRequest) takes a standard request object that contains the property RequestCredentialsProvider (inherited from AmazonWebServiceRequest). However, the implementation uses the method ListNextBatchOfObjectsRequest::toListObjectsRequest() which does not copy the credentials provider (and other properties) to the ListObjectsRequest. As a result, our code failed to have the correct credentials to query S3.
Expected Behavior
The code should copy the request credentials across. The class ListNextBatchOfVersionsRequest does this correctly.
Current Behavior
This is the broken code in ListNextBatchOfObjectsRequest:
public ListObjectsRequest toListObjectsRequest() {
return new ListObjectsRequest(previousObjectListing.getBucketName(),
previousObjectListing.getPrefix(),
previousObjectListing.getNextMarker(),
previousObjectListing.getDelimiter(),
Integer.valueOf(previousObjectListing.getMaxKeys()))
.withEncodingType(previousObjectListing.getEncodingType());
}
This is the correct kind of code in ListNextBatchOfVersionsRequest, note how the extra properties are copied across:
public ListVersionsRequest toListVersionsRequest() {
ListVersionsRequest result = new ListVersionsRequest(previousVersionListing.getBucketName(),
previousVersionListing.getPrefix(),
previousVersionListing.getNextKeyMarker(),
previousVersionListing.getNextVersionIdMarker(),
previousVersionListing.getDelimiter(),
previousVersionListing.getMaxKeys())
.withEncodingType(previousVersionListing.getEncodingType())
.withRequestCredentialsProvider(getRequestCredentialsProvider())
.withGeneralProgressListener(getGeneralProgressListener())
.withRequestMetricCollector(getRequestMetricCollector());
Integer sdkClientExecutionTimeout = getSdkClientExecutionTimeout();
if (sdkClientExecutionTimeout != null) {
result.setSdkClientExecutionTimeout(sdkClientExecutionTimeout);
}
Integer sdkRequestTimeout = getSdkRequestTimeout();
if (sdkClientExecutionTimeout != null) {
result.setSdkRequestTimeout(sdkRequestTimeout);
}
return result;
}
Reproduction Steps
No need for SSCCE. Information above is sufficient.
Upcoming End-of-Support
Describe the bug
The method
AmazonS3Client::listNextBatchOfObjects(ListNextBatchOfObjectsRequest)
takes a standard request object that contains the propertyRequestCredentialsProvider
(inherited fromAmazonWebServiceRequest
). However, the implementation uses the methodListNextBatchOfObjectsRequest::toListObjectsRequest()
which does not copy the credentials provider (and other properties) to theListObjectsRequest
. As a result, our code failed to have the correct credentials to query S3.Expected Behavior
The code should copy the request credentials across. The class
ListNextBatchOfVersionsRequest
does this correctly.Current Behavior
This is the broken code in
ListNextBatchOfObjectsRequest
:This is the correct kind of code in
ListNextBatchOfVersionsRequest
, note how the extra properties are copied across:Reproduction Steps
No need for SSCCE. Information above is sufficient.
Possible Solution
No response
Additional Information/Context
The git repo shows the code is still broken
https://github.com/aws/aws-sdk-java/blob/master/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/model/ListNextBatchOfObjectsRequest.java#L74
AWS Java SDK version used
1.12.609
JDK version used
8
Operating System and version
Windows 11
The text was updated successfully, but these errors were encountered: