Skip to content

== used instead of .equals() for String comparison #1027

Description

@sakshipatil1305

[REQUIRED] Step 2: Describe your environment

  • Operating System version: macOS 14.3
  • Firebase SDK version: 9.4.1
  • Library version: _____
  • Firebase Product: _____ (auth, database, storage, etc)

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

Currently we are using "==" for string comparison . == compares the reference values, so if two variables reference different objects, they will not be equal using == . This can cause potential bugs while using the sdk

Relevant Code:

snipped from AbstractFirebaseAuth : 603
if (providerId == "phone") {
return this.getUserByPhoneNumberOp(uid);
} else if (providerId == "email") {
return this.getUserByEmailOp(uid);
}

solution:

   if ("phone".equals(providerId)) {
      return this.getUserByPhoneNumberOp(uid);
    } else if ( "email".equals(providerId)) {
      return this.getUserByEmailOp(uid);
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions