From f4638d7eece9801b697bc7885652195c3be90abd Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 10 Nov 2017 20:17:42 +0100 Subject: [PATCH] catch some more exception when retrieving media runtime --- .../siacs/conversations/persistance/FileBackend.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java index c1bf21ea0..51eb6d0a1 100644 --- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java @@ -809,7 +809,7 @@ public class FileBackend { MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever(); mediaMetadataRetriever.setDataSource(mXmppConnectionService,uri); return Integer.parseInt(mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION)); - } catch (IllegalArgumentException e) { + } catch (RuntimeException e) { return 0; } } @@ -840,7 +840,7 @@ public class FileBackend { try { metadataRetriever.setDataSource(file.getAbsolutePath()); } catch (Exception e) { - throw new NotAVideoFile(); + throw new NotAVideoFile(e); } return getVideoDimensions(metadataRetriever); } @@ -907,7 +907,13 @@ public class FileBackend { } private static class NotAVideoFile extends Exception { + public NotAVideoFile(Throwable t) { + super(t); + } + public NotAVideoFile() { + super(); + } } public class FileCopyException extends Exception {