Skip to content

Conversation

ankitshokeen
Copy link
Contributor

Issue

#15321

What is the purpose of the change?

This change corrects the behavior of StringUtils.toCommaDelimitedString(String one, String... others) to return null when either argument is null, as described in its Javadoc. Previously, the method would return a string like "null,null", which could lead to misleading outputs and test failures. This update ensures consistency between the method's implementation and its documented contract.

Checklist

  • Make sure there is a GitHub_issue field for the change.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction. If the new feature or significant change is committed, please remember to add sample in dubbo samples project.
  • Make sure gitHub actions can pass. Why the workflow is failing and how to fix it?

@codecov-commenter
Copy link

codecov-commenter commented Apr 26, 2025

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Project coverage is 35.65%. Comparing base (c393896) to head (df5f6d4).
Report is 17 commits behind head on 3.3.

Current head df5f6d4 differs from pull request most recent head 4dc4e28

Please upload reports for the commit 4dc4e28 to get more accurate results.

Files with missing lines Patch % Lines
...ava/org/apache/dubbo/common/utils/StringUtils.java 0.00% 4 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (c393896) and HEAD (df5f6d4). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (c393896) HEAD (df5f6d4)
unit-tests 1 0
Additional details and impacted files
@@              Coverage Diff              @@
##                3.3   #15338       +/-   ##
=============================================
- Coverage     60.76%   35.65%   -25.12%     
+ Complexity    10916    10901       -15     
=============================================
  Files          1886     1886               
  Lines         86127    86130        +3     
  Branches      12903    12904        +1     
=============================================
- Hits          52335    30707    -21628     
- Misses        28335    50972    +22637     
+ Partials       5457     4451     -1006     
Flag Coverage Δ
integration-tests 33.11% <0.00%> (-0.01%) ⬇️
samples-tests 29.23% <0.00%> (-0.13%) ⬇️
unit-tests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

* @since 2.7.8
*/
public static String toCommaDelimitedString(String one, String... others) {
if (one == null || others == null) {
return null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if one != null && others == null

should return one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it should return one

@ankitshokeen ankitshokeen force-pushed the fix/commaDelimited-null-handling branch from 55ddfa4 to df5f6d4 Compare May 7, 2025 18:07
@ankitshokeen ankitshokeen requested a review from AlbumenJ May 7, 2025 18:19
@AlbumenJ AlbumenJ merged commit 84d8cc2 into apache:3.3 May 8, 2025
songxiaosheng

This comment was marked as duplicate.

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.

4 participants