Skip to content

Commit dcd8b9e

Browse files
fix: use .equals() instead of == for strings (#1065)
1 parent af8eed9 commit dcd8b9e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/main/java/com/google/firebase/auth/AbstractFirebaseAuth.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -600,9 +600,10 @@ private CallableOperation<UserRecord, FirebaseAuthException> getUserByProviderUi
600600
// Although we don't really advertise it, we want to also handle
601601
// non-federated idps with this call. So if we detect one of them, we'll
602602
// reroute this request appropriately.
603-
if (providerId == "phone") {
603+
if ("phone".equals(providerId)) {
604604
return this.getUserByPhoneNumberOp(uid);
605-
} else if (providerId == "email") {
605+
}
606+
if ("email".equals(providerId)) {
606607
return this.getUserByEmailOp(uid);
607608
}
608609

src/main/java/com/google/firebase/auth/UserRecord.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ public UpdateRequest setPhoneNumber(@Nullable String phone) {
487487
// *and* by setting providersToUnlink to include 'phone', then we'll reject that. Though
488488
// it might also be reasonable to relax this restriction and just unlink it.
489489
for (String dp : deleteProviderIterable) {
490-
if (dp == "phone") {
490+
if ("phone".equals(dp)) {
491491
throw new IllegalArgumentException(
492492
"Both UpdateRequest.setPhoneNumber(null) and "
493493
+ "UpdateRequest.setProvidersToUnlink(['phone']) were set. To unlink from a "
@@ -601,7 +601,7 @@ public UpdateRequest setProvidersToUnlink(Iterable<String> providerIds) {
601601
for (String id : providerIds) {
602602
checkArgument(!Strings.isNullOrEmpty(id), "providerIds must not be null or empty");
603603

604-
if (id == "phone" && properties.containsKey("phoneNumber")
604+
if ("phone".equals(id) && properties.containsKey("phoneNumber")
605605
&& properties.get("phoneNumber") == null) {
606606
// If we've been told to unlink the phone provider both via setting phoneNumber to null
607607
// *and* by setting providersToUnlink to include 'phone', then we'll reject that. Though

0 commit comments

Comments
 (0)