[Android] Close reader once subs are loaded
Geoffrey Métais
git at videolan.org
Thu Sep 7 16:50:39 CEST 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Sep 7 16:49:50 2017 +0200| [dcf31236c8a51630e812e4d666cfc89ee6e38908] | committer: Geoffrey Métais
Close reader once subs are loaded
> https://code.videolan.org/videolan/vlc-android/commit/dcf31236c8a51630e812e4d666cfc89ee6e38908
---
.../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 13 +++++++++----
1 file changed, 9 insertions(+), 4 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..e229cbfef 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;
@@ -3306,16 +3307,20 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
@Override
protected ArrayList<String> doInBackground(String... strings) {
final String subtitleList_serialized = strings[0];
- ArrayList<String> prefsList = new ArrayList<>();
+ final 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