-
Notifications
You must be signed in to change notification settings - Fork 800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
S3Client deleteObjects with empty object list throws NPE #4021
Comments
@joernschumacher0001 that's not really a As a general rule, the Java SDK doesn't do client-side validation of attributes. This avoids issues in case the service changes a validation rule later in time and customer are still using an old version of the SDK. I tried to reproduce the error, but in my case I got a 400 Bad Request with : Are you using an S3 endpoint, or a third-party endpoint? |
It looks like this issue has not been active for more than five days. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please add a comment to prevent automatic closure, or if the issue is already closed please feel free to reopen it. |
@debora-ito You're right, it's not a I see why it would be a general rule to not do client-side validation and guess I have to (somewhat grumbingly) accept that decision. |
Let us know if you have any other question. |
|
Describe the bug
Passing a
DeleteObjectsRequest
with an empty object List to the default s3 client throws aNullPointerException
.Expected Behavior
Return without an error.
Current Behavior
This does not happen if we verify the list we pass to
deleteObjects()
is not empty.Reproduction Steps
This is a shortcut; in our case, we retrieved a list via
listObjects()
that was empty. We were not aware that we had to check it wasn't before passing it to the delete request.Possible Solution
Check early if the list is empty.
If this behavior is desired on your side, throw an exception right then to fail fast. This could be done as early as in the
DeleteObjectsRequestBuilder#build()
If not, return success immediately.
Additional Information/Context
No response
AWS Java SDK version used
2.20.47
JDK version used
Java 17.0.7.7.1 (Corretto) from https://corretto.aws/downloads/resources/17.0.7.7.1/amazon-corretto-17.0.7.7.1-linux-x64.tar.gz
Operating System and version
local Windows 10 and github action - not sure of OS/version there.
The text was updated successfully, but these errors were encountered: