mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-13 20:12:14 +00:00
Use try-with-resources where possible (#6765)
This commit is contained in:
1 parent
88334073e0
commit
76e5c98dd3
5 files changed
+17
-35
No files matched your search
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user