diff --git a/src/main/org/apache/tools/ant/taskdefs/StreamPumper.java b/src/main/org/apache/tools/ant/taskdefs/StreamPumper.java index 17de047f1..37465fbf7 100644 --- a/src/main/org/apache/tools/ant/taskdefs/StreamPumper.java +++ b/src/main/org/apache/tools/ant/taskdefs/StreamPumper.java @@ -119,12 +119,12 @@ public class StreamPumper implements Runnable { while ((length = is.read(buf)) > 0) { os.write(buf, 0, length); } - if (closeWhenExhausted) { - os.close(); - } } catch (Exception e) { // ignore errors } finally { + if (closeWhenExhausted) { + os.close(); + } synchronized (this) { finished = true; notify();