From da8148a134f2a9feb87b149a8777c02fe3353588 Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Wed, 14 Dec 2022 17:55:44 +0100 Subject: [PATCH] fix spotbug warning "PRMC: Possibly Redundant Method Calls" PRMC: In class com.nextcloud.talk.utils.ssl.MagicKeyManager In class com.nextcloud.talk.utils.ssl.MagicKeyManager In method com.nextcloud.talk.utils.ssl.MagicKeyManager.chooseClientAlias(String[], Principal[], Socket) At MagicKeyManager.java:[line 68] Value getCurrentUser()Lio/reactivex/Maybe; Method com.nextcloud.talk.utils.ssl.MagicKeyManager.chooseClientAlias(String[], Principal[], Socket) appears to call the same method on the same object redundantly Signed-off-by: Marcel Hibbe --- .../java/com/nextcloud/talk/utils/ssl/MagicKeyManager.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/utils/ssl/MagicKeyManager.java b/app/src/main/java/com/nextcloud/talk/utils/ssl/MagicKeyManager.java index 14a13903d..6e1748c0b 100644 --- a/app/src/main/java/com/nextcloud/talk/utils/ssl/MagicKeyManager.java +++ b/app/src/main/java/com/nextcloud/talk/utils/ssl/MagicKeyManager.java @@ -64,8 +64,9 @@ public class MagicKeyManager implements X509KeyManager { @Override public String chooseClientAlias(String[] strings, Principal[] principals, Socket socket) { String alias; - if ((userManager.getCurrentUser().blockingGet() != null && - !TextUtils.isEmpty(alias = userManager.getCurrentUser().blockingGet().getClientCertificate())) || + User currentUser = userManager.getCurrentUser().blockingGet(); + if ((currentUser != null && + !TextUtils.isEmpty(alias = currentUser.getClientCertificate())) || !TextUtils.isEmpty(alias = appPreferences.getTemporaryClientCertAlias()) && new ArrayList<>(Arrays.asList(getClientAliases())).contains(alias)) { return alias;