Avoid leaking CountingOutputStream.

+ Affects org.apache.commons.io.output.CountingOutputStream.
This commit is contained in:
Tobias Preuss 2021-11-18 13:13:04 +01:00
parent c0c0e05a29
commit 2db95470db

View file

@ -21,10 +21,8 @@ class ProgressBodyFactory extends DefaultBodyFactory {
@Override
protected void copyData(InputStream inputStream, OutputStream outputStream) throws IOException {
final CountingOutputStream countingOutputStream = new CountingOutputStream(outputStream);
Timer timer = new Timer();
try {
try (CountingOutputStream countingOutputStream = new CountingOutputStream(outputStream)) {
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {