From f1f3d74ce6ffdd5a2132b1810ed51acaf094d840 Mon Sep 17 00:00:00 2001 From: ardevd Date: Wed, 27 Mar 2019 10:29:52 +0100 Subject: [PATCH] getCapability marked with @NonNull and associated npe check removed. Signed-off-by: ardevd --- .../owncloud/android/datamodel/FileDataStorageManager.java | 2 ++ .../java/com/owncloud/android/files/FileMenuFilter.java | 6 ++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java b/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java index d1e6ea4c92..857dc946a5 100644 --- a/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java +++ b/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java @@ -62,6 +62,7 @@ import java.util.List; import java.util.Locale; import java.util.Set; +import androidx.annotation.NonNull; import androidx.annotation.Nullable; import lombok.Getter; import lombok.Setter; @@ -2023,6 +2024,7 @@ public class FileDataStorageManager { return c; } + @NonNull public OCCapability getCapability(String accountName) { OCCapability capability; Cursor c = getCapabilityCursorForAccount(accountName); diff --git a/src/main/java/com/owncloud/android/files/FileMenuFilter.java b/src/main/java/com/owncloud/android/files/FileMenuFilter.java index 4df158ed21..1d63daf126 100644 --- a/src/main/java/com/owncloud/android/files/FileMenuFilter.java +++ b/src/main/java/com/owncloud/android/files/FileMenuFilter.java @@ -165,7 +165,7 @@ public class FileMenuFilter { private void filter(List toShow, List toHide, boolean inSingleFileFragment) { boolean synchronizing = anyFileSynchronizing(); OCCapability capability = mComponentsGetter.getStorageManager().getCapability(mAccount.name); - boolean endToEndEncryptionEnabled = capability != null && capability.getEndToEndEncryption().isTrue(); + boolean endToEndEncryptionEnabled = capability.getEndToEndEncryption().isTrue(); filterDownload(toShow, toHide, synchronizing); filterRename(toShow, toHide, synchronizing); @@ -184,9 +184,7 @@ public class FileMenuFilter { filterUnsetEncrypted(toShow, toHide, endToEndEncryptionEnabled); filterSetPictureAs(toShow, toHide); filterStream(toShow, toHide); - if (endToEndEncryptionEnabled) { - filterOpenAsRichDocument(toShow, toHide, capability); - } + filterOpenAsRichDocument(toShow, toHide, capability); } private void filterShareFile(List toShow, List toHide, OCCapability capability) {