Skip to content

Commit

Permalink
Fix spotbugs and formatting
Browse files Browse the repository at this point in the history
Signed-off-by: Álvaro Brey Vilas <[email protected]>
  • Loading branch information
AlvaroBrey committed Nov 9, 2021
1 parent 0fd553a commit 8f5f260
Showing 1 changed file with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
import android.os.Bundle;

import com.nextcloud.common.NextcloudClient;
import com.nextcloud.common.OkHttpCredentialsUtil;
import com.owncloud.android.lib.common.accounts.AccountTypeUtils;
import com.owncloud.android.lib.common.accounts.AccountUtils;
import com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException;
import com.owncloud.android.lib.common.network.NetworkUtils;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.nextcloud.common.OkHttpCredentialsUtil;

import java.io.IOException;
import java.security.GeneralSecurityException;
Expand Down Expand Up @@ -206,22 +206,19 @@ public static NextcloudClient createNextcloudClient(Account account, Context app
// TODO avoid calling to getUserData here
String userId = am.getUserData(account, AccountUtils.Constants.KEY_USER_ID);
String username = AccountUtils.getUsernameForAccount(account);
String password = null;
try
{
password = am.blockingGetAuthToken(account,AccountTypeUtils.getAuthTokenTypePass(account.type),false);
if (password==null)
{
String password;
try {
password = am.blockingGetAuthToken(account, AccountTypeUtils.getAuthTokenTypePass(account.type), false);
if (password == null) {
Log_OC.e(TAG, "Error receiving password token (password==null)");
throw new AccountNotFoundException(account,"Error receiving password token (password==null)",null);
throw new AccountNotFoundException(account, "Error receiving password token (password==null)", null);
}
}
catch (Exception e){
} catch (Exception e) {
Log_OC.e(TAG, "Error receiving password token", e);
throw new AccountNotFoundException(account,"Error receiving password token",e);
throw new AccountNotFoundException(account, "Error receiving password token", e);
}

if (username == null || username.isEmpty() || password == null || password.isEmpty()) {
if (username == null || username.isEmpty() || password.isEmpty()) {
throw new AccountNotFoundException(
account,
"Username or password could not be retrieved",
Expand Down

0 comments on commit 8f5f260

Please sign in to comment.