[Android] Logcat: close IO in finally

Jean-Baptiste Kempf git at videolan.org
Fri Jul 18 21:38:33 CEST 2014


vlc-ports/android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Jul 18 21:38:12 2014 +0200| [8eb52cba711b932787001f3fce388739e8df42f4] | committer: Jean-Baptiste Kempf

Logcat: close IO in finally

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=8eb52cba711b932787001f3fce388739e8df42f4
---

 vlc-android/src/org/videolan/vlc/util/Logcat.java |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/util/Logcat.java b/vlc-android/src/org/videolan/vlc/util/Logcat.java
index cea9acb..77e3cb4 100644
--- a/vlc-android/src/org/videolan/vlc/util/Logcat.java
+++ b/vlc-android/src/org/videolan/vlc/util/Logcat.java
@@ -48,15 +48,18 @@ public class Logcat {
         BufferedWriter bw = new BufferedWriter(output);
         String line;
 
-        while ((line = br.readLine()) != null) {
-            bw.write(line);
-            bw.newLine();
+        try {
+            while ((line = br.readLine()) != null) {
+                bw.write(line);
+                bw.newLine();
+            }
+        }catch(Exception e) {}
+        finally {
+            bw.close();
+            output.close();
+            br.close();
+            input.close();
         }
-
-        bw.close();
-        output.close();
-        br.close();
-        input.close();
     }
 
     /**



More information about the Android mailing list