commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frederik Naujoks (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-673) WordUtils.abbreviate() throws undocumented StringIndexOutOfBoundsException (ACTION: Method Removed)
Date Fri, 12 Aug 2011 12:21:27 GMT

    [ https://issues.apache.org/jira/browse/LANG-673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13084065#comment-13084065
] 

Frederik Naujoks commented on LANG-673:
---------------------------------------

Hi, the WordUtils.abbreviate method operated on words, whereas the StringUtils.abbreviate
method ignores "words".

>From the commons.lang 2.4 javadoc (http://commons.apache.org/lang/api-2.4/org/apache/commons/lang/WordUtils.html#abbreviate%28java.lang.String,%20int,%20int,%20java.lang.String%29)
{quote}
Abbreviates a string nicely. This method searches for the first space after the lower limit
and abbreviates the String there. It will also append any String passed as a parameter to
the end of the String. The upper limit can be specified to forcibly abbreviate a String. 
{quote}

StringUtils.abbreviate will cut the supplied String at the given limits. In my usecase that
behavior is not desirable, I do need the WordUtils.abbreviate functionality.

Both abbreviate methods are useful, depending on the usecase.
Please re-add the WordUtils.abbreviate method or supply a method with the old behavior elsewhere.

Thanks,
Frederik

> WordUtils.abbreviate() throws undocumented StringIndexOutOfBoundsException (ACTION: Method
Removed)
> ---------------------------------------------------------------------------------------------------
>
>                 Key: LANG-673
>                 URL: https://issues.apache.org/jira/browse/LANG-673
>             Project: Commons Lang
>          Issue Type: Improvement
>    Affects Versions: 2.5
>            Reporter: Paul Benedict
>             Fix For: 3.0
>
>
> The javadoc does not indicate that the string must already be long enough to abbreviate;
yet it really does or an Exception is thrown. For example, if you try to abbreviate a string
of length 10 at 40 characters, this will fail. I believe this should be allowed... just without
any abbreviation.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message