From d903b9151e73222e065030ef82f9f701f02531d0 Mon Sep 17 00:00:00 2001 From: alperozturk Date: Tue, 1 Oct 2024 13:44:21 +0200 Subject: [PATCH] handle exceptions Signed-off-by: alperozturk --- .../android/ui/fragment/OCFileListFragment.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java index 8f18f60ae1..4e86803dfb 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -132,6 +132,7 @@ import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executors; import java.util.concurrent.Future; +import java.util.concurrent.RejectedExecutionException; import javax.inject.Inject; @@ -982,7 +983,7 @@ public class OCFileListFragment extends ExtendedListFragment implements } } - private Future> getPreviousFile() { + private Future> getPreviousFile() throws NullPointerException, RejectedExecutionException { CompletableFuture> completableFuture = new CompletableFuture<>(); Executors.newCachedThreadPool().submit(() -> { @@ -1026,9 +1027,15 @@ public class OCFileListFragment extends ExtendedListFragment implements mFile = result.second; updateFileList(); return result.first; - } catch (java.util.concurrent.ExecutionException | java.lang.InterruptedException e) { - Log_OC.e(TAG,"Error caught at onBrowseUp: " + e); - return 0; + } catch (java.util.concurrent.ExecutionException | java.lang.InterruptedException | NullPointerException | + RejectedExecutionException e) { + Log_OC.e(TAG,"Error caught in onBrowseUp " + e + " getPreviousFileWithoutFilter() used: "); + + FileDataStorageManager storageManager = mContainerActivity.getStorageManager(); + var result = getPreviousFileWithoutFilter(storageManager); + mFile = result.second; + updateFileList(); + return result.first; } }