Skip to content
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

Remove IOException never thrown in S3Resource methods #1108

Open
alexisgra opened this issue Mar 20, 2024 · 0 comments
Open

Remove IOException never thrown in S3Resource methods #1108

alexisgra opened this issue Mar 20, 2024 · 0 comments

Comments

@alexisgra
Copy link
Contributor

alexisgra commented Mar 20, 2024

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();
	}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant