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 throws IOException that is never thrown in S3Resource methods #1222

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,23 +130,23 @@ public boolean exists() {
}

@Override
public long contentLength() throws IOException {
public long contentLength() {
if (headMetadata == null) {
fetchMetadata();
}
return headMetadata.contentLength;
}

@Override
public long lastModified() throws IOException {
public long lastModified() {
if (headMetadata == null) {
fetchMetadata();
}
return headMetadata.lastModified.toEpochMilli();
}

@Override
public File getFile() throws IOException {
public File getFile() {
throw new UnsupportedOperationException("Amazon S3 resource can not be resolved to java.io.File objects.Use "
+ "getInputStream() to retrieve the contents of the object!");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void existsReturnsFalseWhenObjectDoesNotExist(S3OutputStreamProvider s3OutputStr
}

@TestAvailableOutputStreamProviders
void objectHasContentLength(S3OutputStreamProvider s3OutputStreamProvider) throws IOException {
void objectHasContentLength(S3OutputStreamProvider s3OutputStreamProvider) {
String contents = "test-file-content";
client.putObject(PutObjectRequest.builder().bucket("first-bucket").key("test-file.txt").build(),
RequestBody.fromString(contents));
Expand Down
Loading