Skip to content

Fix handling of null marker in StringUtils.abbreviate(String, String, int, int) #1571

Merged
garydgregory merged 2 commits intoapache:masterfrom
ThrawnCA:abbreviate-short-strings-errors
Jan 17, 2026
Merged

Fix handling of null marker in StringUtils.abbreviate(String, String, int, int) #1571
garydgregory merged 2 commits intoapache:masterfrom
ThrawnCA:abbreviate-short-strings-errors

Conversation

@ThrawnCA
Copy link
Copy Markdown
Contributor

@ThrawnCA ThrawnCA commented Jan 17, 2026

Make abbreviate apply the offset and maxWidth properties correctly when the abbrevMarker is null or empty string.

Partial replacement of #1490

Thanks for your contribution to Apache Commons! Your help is appreciated!

Before you push a pull request, review this list:

  • Read the contribution guidelines for this project.
  • Run a successful build using the default Maven goal with mvn; that's mvn on the command line by itself.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. This may not always be possible, but it is a best practice.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body. Note that a maintainer may squash commits during the merge process.

- treat null marker as empty string
- ensure offset and maxWidth are applied as usual (simple 'substring' won't cut it)
@garydgregory garydgregory changed the title Fix handling of null abbreviate marker Fix handling of null marker in StringUtils.abbreviate(String, String, int, int) Jan 17, 2026
@garydgregory garydgregory merged commit 4a5ef8e into apache:master Jan 17, 2026
74 of 84 checks passed
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