spring-cloud-aws
spring-cloud-aws copied to clipboard
Remove IOException never thrown in S3Resource methods
Type: Feature
Is your feature request related to a problem? Please describe. Several methods of the S3Resource object throw IOExceptions in their signature. But Exception is never thrown in those methods.
Use cases where this is a problem :
I use listObject()
method in S3Template
. I want to use contentLength
or lastModified
fields of S3Resource
to sort the list, but I need to catch IOException in the comparator.
Maybe I missed something but I think that we can remove them.
Describe the solution you'd like
Remove IOException declaration in method signatures in S3Resource
.
I know that S3Resource
inherits AbstractResource
. So I don't know if it is a problem for you to remove the exception in some S3Resource
methods. Moreover, most uses of S3Resource
are made via the S3Template
, so there's no reference to the parent class.
If it is ok for you, you can assign me the ticket, I can make a PR quickly.
Additional context Some examples :
@Override
public long contentLength() throws IOException {
if (headMetadata == null) {
fetchMetadata();
}
return headMetadata.contentLength;
}
@Override
public long lastModified() throws IOException {
if (headMetadata == null) {
fetchMetadata();
}
return headMetadata.lastModified.toEpochMilli();
}