Use try-with-resources where possible (#6765)

This commit is contained in:
Basil Crow authored and GitHub committed 2022-07-04 17:36:33 -07:00
1 parent 88334073e0
commit 76e5c98dd3
5 files changed
+17 -35

No files matched your search

+1 -3
View File
@@ -625,7 +625,7 @@ public class Util {
*/
@NonNull
public static String getDigestOf(@NonNull InputStream source) throws IOException {
try {
try (source) {
MessageDigest md5 = getMd5();
DigestInputStream in = new DigestInputStream(source, md5);
// Note: IOUtils.copy() buffers the input internally, so there is no
@@ -634,8 +634,6 @@ public class Util {
return toHexString(md5.digest());
} catch (NoSuchAlgorithmException e) {
throw new IOException("MD5 not installed", e); // impossible
} finally {
source.close();
}
/* JENKINS-18178: confuses Maven 2 runner
try {