Skip to content

fix: guard against blank FCM device tokens in sendMessageWithResult#2168

Merged
taejinn merged 2 commits intofix/2164-notification-duplicationfrom
copilot/sub-pr-2165-again
Mar 5, 2026
Merged

fix: guard against blank FCM device tokens in sendMessageWithResult#2168
taejinn merged 2 commits intofix/2164-notification-duplicationfrom
copilot/sub-pr-2165-again

Conversation

Copy link

Copilot AI commented Mar 5, 2026

sendMessageWithResult only checked targetDeviceToken == null, allowing empty or whitespace-only tokens to pass through and trigger unnecessary Firebase calls and warn-level log noise.

Change

Replace the null check with !StringUtils.hasText(targetDeviceToken) to early-return false for null, empty, and whitespace tokens:

// Before
if (targetDeviceToken == null) {
    return false;
}

// After
if (!StringUtils.hasText(targetDeviceToken)) {
    return false;
}

Uses org.springframework.util.StringUtils, already present in the project.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: taejinn <140797244+taejinn@users.noreply.github.com>
Copilot AI changed the title [WIP] Update to address feedback on duplicate notification error fix fix: guard against blank FCM device tokens in sendMessageWithResult Mar 5, 2026
@taejinn taejinn marked this pull request as ready for review March 5, 2026 10:45
@taejinn taejinn merged commit 22195a2 into fix/2164-notification-duplication Mar 5, 2026
@taejinn taejinn deleted the copilot/sub-pr-2165-again branch March 5, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants