You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Paul Benedict (JIRA)" <ji...@apache.org> on 2011/01/18 03:50:43 UTC
[jira] Created: (LANG-673) WordUtils.abbreviate() throws
undocumented StringIndexOutOfBoundsException
WordUtils.abbreviate() throws undocumented StringIndexOutOfBoundsException
--------------------------------------------------------------------------
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.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (LANG-673) WordUtils.abbreviate() throws
undocumented StringIndexOutOfBoundsException (Method Removed)
Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LANG-673?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henri Yandell updated LANG-673:
-------------------------------
Summary: WordUtils.abbreviate() throws undocumented StringIndexOutOfBoundsException (Method Removed) (was: WordUtils.abbreviate() throws undocumented StringIndexOutOfBoundsException)
> WordUtils.abbreviate() throws undocumented StringIndexOutOfBoundsException (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.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (LANG-673) WordUtils.abbreviate() throws
undocumented StringIndexOutOfBoundsException
Posted by "Paul Benedict (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LANG-673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12982990#action_12982990 ]
Paul Benedict commented on LANG-673:
------------------------------------
The error happens in line 627: {code}result.append(str.substring(0, upper));{code}
> WordUtils.abbreviate() throws undocumented StringIndexOutOfBoundsException
> --------------------------------------------------------------------------
>
> 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.
-
You can reply to this email to add a comment to the issue online.
[jira] [Issue Comment Edited] (LANG-673) WordUtils.abbreviate()
throws undocumented StringIndexOutOfBoundsException (ACTION: Method
Removed)
Posted by "Frederik Naujoks (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LANG-673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13084065#comment-13084065 ]
Frederik Naujoks edited comment on LANG-673 at 8/12/11 12:23 PM:
-----------------------------------------------------------------
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.
EDIT:
If a method with the WordUtils.abbreviate behavior is located elsewhere please note that in the migration guide.
Thanks,
Frederik
was (Author: fnaujoks):
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
[jira] [Commented] (LANG-673) WordUtils.abbreviate() throws
undocumented StringIndexOutOfBoundsException (ACTION: Method Removed)
Posted by "Frederik Naujoks (JIRA)" <ji...@apache.org>.
[ 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
[jira] Closed: (LANG-673) WordUtils.abbreviate() throws
undocumented StringIndexOutOfBoundsException
Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LANG-673?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henri Yandell closed LANG-673.
------------------------------
Resolution: Fixed
Closing as no discussion. Leaving it in the place it's been longer makes sense.
> WordUtils.abbreviate() throws undocumented StringIndexOutOfBoundsException
> --------------------------------------------------------------------------
>
> 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.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (LANG-673) WordUtils.abbreviate() throws
undocumented StringIndexOutOfBoundsException (ACTION: Method Removed)
Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LANG-673?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henri Yandell updated LANG-673:
-------------------------------
Summary: WordUtils.abbreviate() throws undocumented StringIndexOutOfBoundsException (ACTION: Method Removed) (was: WordUtils.abbreviate() throws undocumented StringIndexOutOfBoundsException (Method Removed))
> 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.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (LANG-673) WordUtils.abbreviate() throws
undocumented StringIndexOutOfBoundsException
Posted by "Paul Benedict (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LANG-673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12983059#action_12983059 ]
Paul Benedict commented on LANG-673:
------------------------------------
Curiously, StringUtils has an abbreviate(), which is a different implementation than this one. Do we need two versions?
> WordUtils.abbreviate() throws undocumented StringIndexOutOfBoundsException
> --------------------------------------------------------------------------
>
> 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.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (LANG-673) WordUtils.abbreviate() throws
undocumented StringIndexOutOfBoundsException
Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LANG-673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12985254#action_12985254 ]
Henri Yandell commented on LANG-673:
------------------------------------
I don't think so.
I've removed the WordUtils.abbreviate version as it's the newer of the pair.
svn ci -m "Removing WordUtils.abbreviate as it's already found in StringUtils.abbreviate. This was identified in LANG-673" src/main/java/org/apache/commons/lang3/text/WordUtils.java src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java
Sending src/main/java/org/apache/commons/lang3/text/WordUtils.java
Sending src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java
Transmitting file data ..
Committed revision 1062328.
Leaving this open to discuss whether the StringUtils.abbreviate method is preferred in WordUtils.
> WordUtils.abbreviate() throws undocumented StringIndexOutOfBoundsException
> --------------------------------------------------------------------------
>
> 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.
-
You can reply to this email to add a comment to the issue online.