From 029b290a312baa5b576209a79eb140d6cca57b88 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 13 Oct 2022 08:46:26 +0200 Subject: [PATCH] Close FOS Signed-off-by: tobiasKaminsky --- .../owncloud/android/ui/asynctasks/PrintAsyncTask.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/owncloud/android/ui/asynctasks/PrintAsyncTask.java b/app/src/main/java/com/owncloud/android/ui/asynctasks/PrintAsyncTask.java index b3ef92fbe1..522462be73 100644 --- a/app/src/main/java/com/owncloud/android/ui/asynctasks/PrintAsyncTask.java +++ b/app/src/main/java/com/owncloud/android/ui/asynctasks/PrintAsyncTask.java @@ -73,7 +73,7 @@ public class PrintAsyncTask extends AsyncTask { HttpClient client = new HttpClient(); GetMethod getMethod = null; - FileOutputStream fos; + FileOutputStream fos = null; try { getMethod = new GetMethod(url); int status = client.executeMethod(getMethod); @@ -123,6 +123,13 @@ public class PrintAsyncTask extends AsyncTask { if (getMethod != null) { getMethod.releaseConnection(); } + if (fos != null) { + try { + fos.close(); + } catch (IOException e) { + Log_OC.e(TAG, "Error closing file output stream", e); + } + } } return Boolean.TRUE;