Skip to content

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

Closed

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

  1. google-oss-bot commented on Oct 24, 2024

    @google-oss-bot

    I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

  2. yanikapitanov commented on Jan 24, 2025

    @yanikapitanov
    Contributor

    Can I take this issue? I already have the code

  3. shubhi510 commented on Jan 24, 2025

    @shubhi510
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