firebase / firebase-admin-java

Firebase Admin Java SDK
https://firebase.google.com/docs/admin/setup
Apache License 2.0
541 stars 269 forks source link

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

Open sakshipatil1305 opened 1 week ago

sakshipatil1305 commented 1 week ago

[REQUIRED] Step 2: Describe your environment

[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);
    }
google-oss-bot commented 1 week ago

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