Prior to this commit, zero size String array returns if StringUtils.delimitedListToStringArray is called with parameter empty String ("")
I think, after call StringUtils.delimitedListToStringArray("", ",", null);
it should return one size String array -> [""]
but it returns zero size String array.
StringUtils.delimitedListToStringArray(null, ",", null) & StringUtils.delimitedListToStringArray("", ",", null)
should returns differently. However there are same results.
There's no logic for empty String(""), but just is for null parameter.
I added if statement for "" parameter. The result will be one size String array.
And also in SPR-11126, the issue will be fine.
Issue: SPR-11126
Comment From: snicoll
fyi, if you need to make changes to an existing pull request, you can just push to your branch instead of creating a separate pull request.
Have you signed the CLA?
Comment From: youngjee
I have signed and agree to the terms of the SpringSource Individual Contributor License Agreement.
Comment From: philwebb
I think this change might break existing code which expects the current behavior. There is an existing test for this.
Comment From: youngjee
I think the testcase ,when String is null and empty, shouldn't have been same.
Is there any purpose that empty String and null String return same result?
I changed the testcase
public void testCommaDelimitedListToStringArrayWithEmptyStringProducesEmptyArray() { String[] sa = StringUtils.commaDelimitedListToStringArray(""); assertTrue("String array isn't null with null input", sa != null); assertTrue("String array length == 0 with null input", sa.length == 0); }
-> sa.length==1
Comment From: pivotal-issuemaster
@youngjee Please sign the Contributor License Agreement!
Click here to manually synchronize the status of this Pull Request.
See the FAQ for frequently asked questions.