[Libreoffice-commits] online.git: android/app

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Tue Mar 10 13:25:53 UTC 2020


 android/app/src/main/java/org/libreoffice/androidapp/ui/RecentFilesAdapter.java |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 943ef670b5b58b18a291006f0b7a62a96baee25c
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Mar 9 10:35:11 2020 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Tue Mar 10 14:25:35 2020 +0100

    android: handle security exception in recent files
    
    Change-Id: Iad7de414ab94a8d9a2997cb8d6c64d0544fc7c77
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90209
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/android/app/src/main/java/org/libreoffice/androidapp/ui/RecentFilesAdapter.java b/android/app/src/main/java/org/libreoffice/androidapp/ui/RecentFilesAdapter.java
index df162477b..4a06899a9 100644
--- a/android/app/src/main/java/org/libreoffice/androidapp/ui/RecentFilesAdapter.java
+++ b/android/app/src/main/java/org/libreoffice/androidapp/ui/RecentFilesAdapter.java
@@ -50,8 +50,9 @@ class RecentFilesAdapter extends RecyclerView.Adapter<RecentFilesAdapter.ViewHol
     /** Return the filename of the given Uri. */
     public static String getUriFilename(Activity activity, Uri uri) {
         String filename = "";
-        Cursor cursor = activity.getContentResolver().query(uri, null, null, null, null);
+        Cursor cursor = null;
         try {
+            cursor = activity.getContentResolver().query(uri, null, null, null, null);
             if (cursor != null && cursor.moveToFirst())
                 filename = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME));
         } finally {
@@ -71,8 +72,9 @@ class RecentFilesAdapter extends RecyclerView.Adapter<RecentFilesAdapter.ViewHol
     /** Return the size of the given Uri. */
     public static long getUriFileLength(Activity activity, Uri uri) {
         long length = 0;
-        Cursor cursor = activity.getContentResolver().query(uri, null, null, null, null);
+        Cursor cursor = null;
         try {
+            cursor = activity.getContentResolver().query(uri, null, null, null, null);
             if (cursor != null && cursor.moveToFirst())
                 length = cursor.getLong(cursor.getColumnIndex(OpenableColumns.SIZE));
         } finally {


More information about the Libreoffice-commits mailing list