Skip to content

Handle NumberFormatException in UserInfoCacheServiceImpl.onlineUser()#185

Merged
crossoverJie merged 3 commits intofeature/add-checkstyle-code-stylefrom
copilot/sub-pr-182-another-one
Feb 5, 2026
Merged

Handle NumberFormatException in UserInfoCacheServiceImpl.onlineUser()#185
crossoverJie merged 3 commits intofeature/add-checkstyle-code-stylefrom
copilot/sub-pr-182-another-one

Conversation

Copy link
Contributor

Copilot AI commented Feb 5, 2026

The onlineUser() method crashes when Redis contains non-numeric user IDs due to uncaught NumberFormatException from Long.valueOf().

Changes

  • Added try-catch around Long.valueOf(member) to handle invalid formats
  • Added @Slf4j for logging invalid entries with warning message
  • Method now skips malformed entries and continues processing remaining users
for (String member : members) {
    try {
        Optional<CIMUserInfo> cimUserInfo = loadUserInfoByUserId(Long.valueOf(member));
        cimUserInfo.ifPresent(set::add);
    } catch (NumberFormatException e) {
        log.warn("Skipping invalid user ID format in Redis set: {}", member);
    }
}

This ensures the online user list remains available even if Redis data becomes corrupted or invalid data is manually inserted.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 5, 2026 02:37
…ser()

Co-authored-by: crossoverJie <15684156+crossoverJie@users.noreply.github.com>
Co-authored-by: crossoverJie <15684156+crossoverJie@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 5, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • checkstyle.org
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.24.0/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.24.0/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.24.0/x64/codeql/xml/tools/xml-extractor.jar --fileList=/home/REDACTED/work/cim/.codeql-scratch/dbs/java/working/files-to-index10017956466008416425.list --sourceArchiveDir=/home/REDACTED/work/cim/.codeql-scratch/dbs/java/src --outputDir=/home/REDACTED/work/cim/.codeql-scratch/dbs/java/trap/java y ash ntime.v2.task/mogit users.noreply.gicheckout k/_temp/ghcca-nocopilot/sub-pr-182-another-one grep -l ad1c85bae8d81711-i y ash ntime.v2.task/mols orithm/consisten-alF 2de/log.json (dns block)
  • mybatis.org
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.24.0/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.24.0/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.24.0/x64/codeql/xml/tools/xml-extractor.jar --fileList=/home/REDACTED/work/cim/.codeql-scratch/dbs/java/working/files-to-index10017956466008416425.list --sourceArchiveDir=/home/REDACTED/work/cim/.codeql-scratch/dbs/java/src --outputDir=/home/REDACTED/work/cim/.codeql-scratch/dbs/java/trap/java y ash ntime.v2.task/mogit users.noreply.gicheckout k/_temp/ghcca-nocopilot/sub-pr-182-another-one grep -l ad1c85bae8d81711-i y ash ntime.v2.task/mols orithm/consisten-alF 2de/log.json (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Refactor to apply review feedback on Checkstyle PR Handle NumberFormatException in UserInfoCacheServiceImpl.onlineUser() Feb 5, 2026
Copilot AI requested a review from crossoverJie February 5, 2026 02:41
@codecov
Copy link

codecov bot commented Feb 5, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.37%. Comparing base (109101e) to head (783de2a).
⚠️ Report is 9 commits behind head on feature/add-checkstyle-code-style.

Files with missing lines Patch % Lines
...m/route/service/impl/UserInfoCacheServiceImpl.java 66.66% 2 Missing ⚠️
Additional details and impacted files
@@                           Coverage Diff                           @@
##             feature/add-checkstyle-code-style     #185      +/-   ##
=======================================================================
- Coverage                                50.37%   50.37%   -0.01%     
- Complexity                                 317      318       +1     
=======================================================================
  Files                                       79       79              
  Lines                                     1725     1729       +4     
  Branches                                   133      133              
=======================================================================
+ Hits                                       869      871       +2     
- Misses                                     816      818       +2     
  Partials                                    40       40              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@crossoverJie crossoverJie marked this pull request as ready for review February 5, 2026 02:50
@crossoverJie crossoverJie merged commit 3ae257b into feature/add-checkstyle-code-style Feb 5, 2026
3 checks passed
@crossoverJie crossoverJie deleted the copilot/sub-pr-182-another-one branch February 5, 2026 02:51
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