aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Lynggaard Hansen2012-07-07 15:25:40 (EDT)
committerHenrik Lynggaard Hansen2012-07-07 15:25:40 (EDT)
commit92519a8cbf5482d4e136b7ed23a079a7556fda87 (patch)
treeacbd025fc05a5a7d812da8221519e2f09fd624e1
parentb3f23e82c67f65adc91ce3f463f3ceb272694b80 (diff)
downloadorg.eclipse.hudson.core-92519a8cbf5482d4e136b7ed23a079a7556fda87.zip
org.eclipse.hudson.core-92519a8cbf5482d4e136b7ed23a079a7556fda87.tar.gz
org.eclipse.hudson.core-92519a8cbf5482d4e136b7ed23a079a7556fda87.tar.bz2
logger in Run might not be closed on exceptionrefs/changes/64/6664/1
In Run.run the outputstream logger might not be closed if a exception happens before it is used in a listener. Change-Id: Ie74397f6fe6fdff82596a67befe46f5b28507ab1 Signed-off-by: Henrik Lynggaard Hansen <henrik@hlyh.dk>
-rw-r--r--hudson-core/src/main/java/hudson/model/Run.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/hudson-core/src/main/java/hudson/model/Run.java b/hudson-core/src/main/java/hudson/model/Run.java
index cb7ceaf..5c87d50 100644
--- a/hudson-core/src/main/java/hudson/model/Run.java
+++ b/hudson-core/src/main/java/hudson/model/Run.java
@@ -1320,7 +1320,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
// otherwise the queue state becomes inconsistent
long start = System.currentTimeMillis();
-
+ OutputStream logger = null;
try {
try {
Charset charset = Computer.currentComputer().getDefaultCharset();
@@ -1329,7 +1329,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
// don't do buffering so that what's written to the listener
// gets reflected to the file immediately, which can then be
// served to the browser immediately
- OutputStream logger = new FileOutputStream(getLogFile());
+ logger = new FileOutputStream(getLogFile());
RunT build = job.getBuild();
// Global log filters
@@ -1409,6 +1409,10 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
listener.finished(result);
if(listener!=null)
listener.closeQuietly();
+
+ if (logger != null) {
+ IOUtils.closeQuietly(logger);
+ }
try {
save();