Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added logs on 4.0.2 #1778

Draft
wants to merge 3 commits into
base: release/4.0.2
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common
Submodule common updated 148 files
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,13 @@ public void onTaskCompleted(final List<ICacheRecord> result) {
// To simplify the logic, if more than one account is returned, the first account will be picked.
// We do not support switching from MULTIPLE to SINGLE.
// See getAccountFromICacheRecordList() for more details.
Logger.info(TAG, "onTaskCompleted of getCurrentAccount, result size is "+ result.size());
final MultiTenantAccount oldAccount = getPersistedCurrentAccount();
if (oldAccount != null)
Logger.info(TAG, "onTaskCompleted of getCurrentAccount, oldAccount is "+ oldAccount.getUsername() + " with id "+oldAccount.getId());
else {
Logger.info(TAG, "onTaskCompleted of getCurrentAccount, oldAccount is null");
}
persistCurrentAccount(result);
checkCurrentAccountNotifyCallback(callback, result, oldAccount);
}
Expand Down Expand Up @@ -179,6 +185,7 @@ public ICurrentAccountResult getCurrentAccount() throws InterruptedException, Ms
new CurrentAccountCallback() {
@Override
public void onAccountLoaded(@Nullable final IAccount activeAccount) {
Logger.info(TAG, "calling onAccountLoaded with account "+activeAccount.getUsername());
final CurrentAccountResult currentAccountResult = new CurrentAccountResult(
activeAccount,
null,
Expand All @@ -191,6 +198,7 @@ public void onAccountLoaded(@Nullable final IAccount activeAccount) {
@Override
public void onAccountChanged(@Nullable final IAccount priorAccount,
@Nullable final IAccount currentAccount) {

final CurrentAccountResult currentAccountResult = new CurrentAccountResult(
currentAccount,
priorAccount,
Expand Down Expand Up @@ -234,9 +242,10 @@ private void checkCurrentAccountNotifyCallback(@NonNull final CurrentAccountCall
: getAccountFromICacheRecordList(newAccountRecords);

if (!isHomeAccountIdMatching(oldAccount, newAccount)) {
Logger.info(TAG,"in checkCurrentAccountNotifyCallback homeAccount is not matching the old one!, hence calling onAccountChanged");
callback.onAccountChanged(oldAccount, newAccount);
}

Logger.info(TAG,"calling onAccountLoaded with new account "+ newAccount.getUsername());
callback.onAccountLoaded(newAccount);
}

Expand Down Expand Up @@ -600,6 +609,12 @@ private MultiTenantAccount getPersistedCurrentAccount() {
* Please note that this layer will not verify if the list belongs to a single account or not.
*/
private void persistCurrentAccount(@Nullable final List<ICacheRecord> cacheRecords) {
Logger.info(
TAG, "in persistCurrentAccount to persist following records in sharedPref");
for (ICacheRecord cacheRecord : cacheRecords) {
Logger.info(
TAG,cacheRecord.getAccount().getUsername());
}
synchronized(SingleAccountPublicClientApplication.class) {
if (cacheRecords == null || cacheRecords.size() == 0) {
sharedPreferencesFileManager.clear();
Expand Down Expand Up @@ -628,13 +643,13 @@ private MultiTenantAccount getAccountFromICacheRecordList(@NonNull final List<IC
final List<IAccount> account = AccountAdapter.adapt(cacheRecords);

if (account.size() != 1) {
Logger.verbose(
Logger.info(
methodTag,
"Returned cacheRecords were adapted into multiple IAccount. " +
"This is unexpected in Single account mode." +
"Returning the first adapted account.");
}

Logger.info(methodTag, "getAccountFromICacheRecordList returned account, username is "+ account.get(0).getUsername());
return (MultiTenantAccount) account.get(0);
}

Expand Down