Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use .equals() instead of == for strings #1065

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -600,9 +600,10 @@ private CallableOperation<UserRecord, FirebaseAuthException> getUserByProviderUi
// Although we don't really advertise it, we want to also handle
// non-federated idps with this call. So if we detect one of them, we'll
// reroute this request appropriately.
if (providerId == "phone") {
if ("phone".equals(providerId)) {
return this.getUserByPhoneNumberOp(uid);
} else if (providerId == "email") {
}
if ("email".equals(providerId)) {
return this.getUserByEmailOp(uid);
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/google/firebase/auth/UserRecord.java
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ public UpdateRequest setPhoneNumber(@Nullable String phone) {
// *and* by setting providersToUnlink to include 'phone', then we'll reject that. Though
// it might also be reasonable to relax this restriction and just unlink it.
for (String dp : deleteProviderIterable) {
if (dp == "phone") {
if ("phone".equals(dp)) {
throw new IllegalArgumentException(
"Both UpdateRequest.setPhoneNumber(null) and "
+ "UpdateRequest.setProvidersToUnlink(['phone']) were set. To unlink from a "
Expand Down Expand Up @@ -601,7 +601,7 @@ public UpdateRequest setProvidersToUnlink(Iterable<String> providerIds) {
for (String id : providerIds) {
checkArgument(!Strings.isNullOrEmpty(id), "providerIds must not be null or empty");

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