From 93c31be1b75940dfd2e8a3c5954a4d57f4c8e6d5 Mon Sep 17 00:00:00 2001 From: Christoph Kutzinski Date: Fri, 14 Jun 2013 18:36:08 +0200 Subject: [PATCH] [FIXED JENKINS-18351] file descriptor leak while fingerprinting --- changelog.html | 3 +++ core/src/main/java/hudson/FilePath.java | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/changelog.html b/changelog.html index 1e4b36092a..2955748ae5 100644 --- a/changelog.html +++ b/changelog.html @@ -61,6 +61,9 @@ Upcoming changes
  • “Projects tied to slave” shows unrelated Maven module jobs. (issue 17451) +
  • + Fixed file descriptor leak in fingerprint computation. + (issue 18351)
  • Added a new extension point to monitor the flow of stuff in the queue.
  • diff --git a/core/src/main/java/hudson/FilePath.java b/core/src/main/java/hudson/FilePath.java index ecd2b97ce5..a81ea7772a 100644 --- a/core/src/main/java/hudson/FilePath.java +++ b/core/src/main/java/hudson/FilePath.java @@ -1664,7 +1664,12 @@ public final class FilePath implements Serializable { return act(new FileCallable() { private static final long serialVersionUID = 1L; public String invoke(File f, VirtualChannel channel) throws IOException { - return Util.getDigestOf(new BufferedInputStream(new FileInputStream(f))); + BufferedInputStream source = new BufferedInputStream(new FileInputStream(f)); + try { + return Util.getDigestOf(source); + } finally { + source.close(); + } } }); }