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 <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2022-12-14 17:55:44 +01:00 committed by Andy Scherzinger
parent e238c4c9e5
commit da8148a134
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B

View File

@ -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;