[Android] Close reader once subs are loaded
Geoffrey Métais
git at videolan.org
Thu Sep 7 16:55:54 CEST 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Sep 7 16:49:50 2017 +0200| [c4f136012e970b3f067e89a3a6d3d90b5b679b84] | committer: Geoffrey Métais
Close reader once subs are loaded
> https://code.videolan.org/videolan/vlc-android/commit/c4f136012e970b3f067e89a3a6d3d90b5b679b84
---
.../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index 746ca0087..a32c3721b 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -130,6 +130,7 @@ import org.videolan.vlc.util.FileUtils;
import org.videolan.vlc.util.Permissions;
import org.videolan.vlc.util.Strings;
import org.videolan.vlc.util.SubtitlesDownloader;
+import org.videolan.vlc.util.Util;
import org.videolan.vlc.util.VLCInstance;
import java.io.ByteArrayInputStream;
@@ -3309,13 +3310,17 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
ArrayList<String> prefsList = new ArrayList<>();
if (subtitleList_serialized != null) {
- ByteArrayInputStream bis = new ByteArrayInputStream(subtitleList_serialized.getBytes());
+ final ByteArrayInputStream bis = new ByteArrayInputStream(subtitleList_serialized.getBytes());
+ ObjectInputStream ois = null;
try {
- ObjectInputStream ois = new ObjectInputStream(bis);
+ ois = new ObjectInputStream(bis);
prefsList = (ArrayList<String>) ois.readObject();
} catch (InterruptedIOException ignored) {
return prefsList; /* Task is cancelled */
- } catch (ClassNotFoundException | IOException ignored) {}
+ } catch (ClassNotFoundException | IOException ignored) {
+ } finally {
+ Util.close(ois);
+ }
}
if (!TextUtils.equals(mUri.getScheme(), "content"))
More information about the Android
mailing list