Skip to content

Commit

Permalink
Merge pull request #127 from MMeent/patch-1
Browse files Browse the repository at this point in the history
[JENKINS-60916] Revert try-with-resources for S3GzipCallable
  • Loading branch information
rsandell authored Oct 15, 2021
2 parents f922339 + c1e7eb9 commit c5f2238
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main/java/hudson/plugins/s3/callable/S3GzipCallable.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,17 @@ public void progressChanged(ProgressEvent event) {
}

@Override
@SuppressFBWarnings("RV_RETURN_VALUE_IGNORED_BAD_PRACTICE")
@SuppressFBWarnings({"RV_RETURN_VALUE_IGNORED_BAD_PRACTICE","OBL_UNSATISFIED_OBLIGATION"})
public String invoke(FilePath file) throws IOException, InterruptedException {
final File localFile = gzipFile(file);
Upload upload = null;

try (final InputStream gzippedStream = new FileInputStream(localFile)) {
try {
// This stream is asynchronously used in startUploading,
// so we cannot use its AutoCloseable behaviour with a
// try-with-resources statement, as that would likely
// close the stream before the upload has succeeded.
final InputStream gzippedStream = new FileInputStream(localFile);
final ObjectMetadata metadata = buildMetadata(file);
metadata.setContentEncoding("gzip");
metadata.setContentLength(localFile.length());
Expand Down

0 comments on commit c5f2238

Please sign in to comment.