Skip to content

Trim the license names in includedLicenses and excludedLicenses - #734

Merged
slachiewicz merged 1 commit into
masterfrom
string-to-list-whitespace
Aug 26, 2026
Merged

slachiewicz merged 1 commit into
masterfrom
string-to-list-whitespace

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

The pipe-separated form of includedLicenses and excludedLicenses only tolerated whitespace around the separator, so the first and last name in a list broken over several lines kept the indentation the XML gave them and matched nothing:

<includedLicenses>
  Apache License 2.0
  |MIT License
</includedLicenses>

That form is not just a matter of taste. An XML formatter breaks a long enough value over several lines on its own.

Extracted from #622, where @Master-Code-Programmer reported it. Trimming in addEntryToList covers the element-per-license form too, where the whitespace comes from the same place.

One behaviour change beyond the fix: an empty value used to produce a list holding the empty string, which matched no license, and now produces an empty list.

Verified: the new StringToListTest fails on master on both counts.

This change was created with AI assistance.

An empty list also used to hold one entry, the empty string, which
matches no license and so was harmless, but it is gone now.

Co-authored-by: Jan-Hendrik Diederich <1955253+Master-Code-Programmer@users.noreply.github.com>
@slachiewicz slachiewicz added bug Something isn't working add-third-party labels Aug 23, 2026
@slachiewicz
slachiewicz marked this pull request as ready for review August 23, 2026 10:30
@slachiewicz
slachiewicz merged commit 6aa49a0 into master Aug 26, 2026
20 checks passed
@slachiewicz
slachiewicz deleted the string-to-list-whitespace branch August 26, 2026 22:38
@github-actions github-actions Bot added this to the 2.7.2 milestone Aug 26, 2026
Master-Code-Programmer added a commit to Master-Code-Programmer/license-maven-plugin that referenced this pull request Sep 19, 2026
â€Ķhaus#734)

An empty list also used to hold one entry, the empty string, which
matches no license and so was harmless, but it is gone now.

Co-authored-by: Jan-Hendrik Diederich <1955253+Master-Code-Programmer@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add-third-party bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant