Commit cc204bc4 authored by peconn's avatar peconn Committed by Commit bot

Compare account name values, not addresses.

I fell prey to one of the classic Java bugs.

BUG=626544

Review-Url: https://codereview.chromium.org/2136083002
Cr-Commit-Position: refs/heads/master@{#405175}
parent 05b7d4f1
......@@ -65,7 +65,7 @@ public class ConfirmSyncDataStateMachine
private final String mOldAccountName;
private final String mNewAccountName;
private final boolean mCurrentlyManaged;
private final Promise<Boolean> mNewAccountManaged = new Promise<Boolean>();
private final Promise<Boolean> mNewAccountManaged = new Promise<>();
private final FragmentManager mFragmentManager;
private final Context mContext;
private final ImportSyncType mImportSyncType;
......@@ -78,6 +78,9 @@ public class ConfirmSyncDataStateMachine
public static void run(String oldAccountName, String newAccountName,
ImportSyncType importSyncType, FragmentManager fragmentManager, Context context,
ConfirmImportSyncDataDialog.Listener callback) {
// Includes implicit not-null assertion.
assert !newAccountName.equals("") : "New account name must be provided.";
ConfirmSyncDataStateMachine stateMachine = new ConfirmSyncDataStateMachine(oldAccountName,
newAccountName, importSyncType, fragmentManager, context, callback);
stateMachine.progress();
......@@ -110,7 +113,7 @@ public class ConfirmSyncDataStateMachine
case BEFORE_OLD_ACCOUNT_DIALOG:
mState = BEFORE_NEW_ACCOUNT_DIALOG;
if (TextUtils.isEmpty(mOldAccountName) || mOldAccountName == mNewAccountName) {
if (TextUtils.isEmpty(mOldAccountName) || mNewAccountName.equals(mOldAccountName)) {
// If there is no old account or the user is just logging back into whatever
// they were previously logged in as, progress past the old account checks.
progress();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment