Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-1463

StringUtils abbreviate returns String of length greater than maxWidth

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.6, 3.7, 3.8, 3.9
    • 3.10
    • lang.*
    • None

    Description

      In the JavaDoc of StringUtils.abbreviate(final String str, final String abbrevMarker, final int maxWidth) is written, that the method in no case will return a String of length greater than maxWidth. This doesn't hold, if abbrevMarker is an empty string.

      Expected behaviour:

      abbreviate("much too long text", "", 13).equals("much too long")

       

      Actual behaviour:

      abbreviate("much too long text", "", 13).equals("much too long text")

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            twessendorf Thomas Wessendorf
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment