Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2ABB684E6 for ; Fri, 12 Aug 2011 12:22:00 +0000 (UTC) Received: (qmail 55233 invoked by uid 500); 12 Aug 2011 12:21:59 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 54543 invoked by uid 500); 12 Aug 2011 12:21:56 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 54263 invoked by uid 99); 12 Aug 2011 12:21:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Aug 2011 12:21:51 +0000 X-ASF-Spam-Status: No, hits=-2000.8 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Aug 2011 12:21:48 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 861CEB965D for ; Fri, 12 Aug 2011 12:21:27 +0000 (UTC) Date: Fri, 12 Aug 2011 12:21:27 +0000 (UTC) From: "Frederik Naujoks (JIRA)" To: issues@commons.apache.org Message-ID: <1403462555.32969.1313151687546.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <11599985.26881295319043383.JavaMail.jira@thor> Subject: [jira] [Commented] (LANG-673) WordUtils.abbreviate() throws undocumented StringIndexOutOfBoundsException (ACTION: Method Removed) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on 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