Fix splitCommaSeparated behavior and add unit tests#962
Open
YCharanGowda wants to merge 4 commits intoapache:mainfrom
Open
Fix splitCommaSeparated behavior and add unit tests#962YCharanGowda wants to merge 4 commits intoapache:mainfrom
YCharanGowda wants to merge 4 commits intoapache:mainfrom
Conversation
markt-asf
requested changes
Mar 20, 2026
Contributor
markt-asf
left a comment
There was a problem hiding this comment.
You haven't explained what problem this PR is trying to solve.
What is the correct behaviour for an input of ",,," and on what are you basing that assertion?
Where is the behaviour currently inconsistent? And how does it impact Tomcat?
| Assert.fail("ParameterMap is not locked."); | ||
| } catch (UnsupportedOperationException expectedException) { | ||
| } | ||
|
|
Contributor
There was a problem hiding this comment.
No. This is here for readability
| } catch (UnsupportedOperationException expectedException) { | ||
| } | ||
| } | ||
| @Test |
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package org.apache.tomcat.util.buf; |
Contributor
There was a problem hiding this comment.
Absolutely not. It is TOTALLY unacceptable to remove a license header.
Comment on lines
-25
to
10
| * None of these tests should throw a NPE. | ||
| * | ||
| */ |
Contributor
There was a problem hiding this comment.
Why is this explanatory comment removed?
| Assert.assertEquals("", StringUtils.join((String[]) null)); | ||
| } | ||
|
|
||
|
|
| Assert.assertEquals("", StringUtils.join(null, ',')); | ||
| } | ||
|
|
||
|
|
| Assert.assertEquals("", sb.toString()); | ||
| } | ||
|
|
||
|
|
| Assert.assertEquals("", sb.toString()); | ||
| } | ||
|
|
||
|
|
| } | ||
| } | ||
|
|
||
| // ✅ Added tests by Y Charan |
Contributor
There was a problem hiding this comment.
Remove this line. We do not advertise authorship in the Tomcat code base.
Comment on lines
+70
to
+71
| // 🔥 | ||
|
|
markt-asf
reviewed
Mar 20, 2026
| public void testEmptyParameterMap() { | ||
| Map<String,String[]> map = new ParameterMap<>(); | ||
| Assert.assertTrue(map.isEmpty()); | ||
| } |
Contributor
There was a problem hiding this comment.
What has this got to do with the stated purpose of the PR?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change improves robustness of StringUtils without affecting existing logic.