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

Log a message when we fail to extract information from homeAccountId #1615

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import androidx.annotation.Nullable;

import com.microsoft.identity.common.adal.internal.util.StringExtensions;
import com.microsoft.identity.common.logging.Logger;

import java.util.AbstractMap;
import java.util.Iterator;
Expand All @@ -41,6 +42,7 @@
* String utilities.
*/
public final class StringUtil {
private static final String TAG = StringUtil.class.getSimpleName();

private StringUtil() {
// Utility class.
Expand Down Expand Up @@ -135,6 +137,15 @@ public static Map.Entry<String, String> getTenantInfo(@NonNull final String home
&& !StringExtensions.isNullOrBlank(uidUtidArray[INDEX_UTID])) {
uid = uidUtidArray[INDEX_UID];
utid = uidUtidArray[INDEX_UTID];
} else {
Logger.warn(TAG, "We had a home account id that could not be split correctly, " +
"We expected it to split into " +
EXPECTED_LENGTH + " parts but instead we had " + uidUtidArray.length + " when " +
"splitting the string on dot ('.')");
Logger.warnPII(TAG, "We had a home account id that could not be split correctly, " +
"Its value was: '" + homeAccountId + "', and we expected it to split into " +
EXPECTED_LENGTH + " parts but instead we had " + uidUtidArray.length + " when " +
"splitting the string on dot ('.')");
}

return new AbstractMap.SimpleEntry<>(uid, utid);
Expand Down