Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 38138200C2E for ; Sun, 5 Mar 2017 10:25:39 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 36A0D160B6B; Sun, 5 Mar 2017 09:25:39 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 7D729160B65 for ; Sun, 5 Mar 2017 10:25:38 +0100 (CET) Received: (qmail 20207 invoked by uid 500); 5 Mar 2017 09:25:37 -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 20196 invoked by uid 99); 5 Mar 2017 09:25:37 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 05 Mar 2017 09:25:37 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 1607EC0096 for ; Sun, 5 Mar 2017 09:25:36 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.547 X-Spam-Level: X-Spam-Status: No, score=-1.547 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-2.999, SPF_NEUTRAL=0.652] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id uAWflBzdL69h for ; Sun, 5 Mar 2017 09:25:35 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 0FBA75F201 for ; Sun, 5 Mar 2017 09:25:35 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 4BF92E0419 for ; Sun, 5 Mar 2017 09:25:34 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 081132416A for ; Sun, 5 Mar 2017 09:25:33 +0000 (UTC) Date: Sun, 5 Mar 2017 09:25:33 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (LANG-1300) Clarify or improve behaviour of int-based methods in StringUtils MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Sun, 05 Mar 2017 09:25:39 -0000 [ https://issues.apache.org/jira/browse/LANG-1300?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15896133#comment-15896133 ] ASF GitHub Bot commented on LANG-1300: -------------------------------------- Github user coveralls commented on the issue: https://github.com/apache/commons-lang/pull/250 [![Coverage Status](https://coveralls.io/builds/10437855/badge)](https://coveralls.io/builds/10437855) Coverage decreased (-0.08%) to 94.455% when pulling **cc70a8aa73b7a3da4ca08629c470baf60b7b89a2 on MarkDacek:LANG-1300** into **6597c196521af500feef7a02610727eafa7ec1dc on apache:master**. > Clarify or improve behaviour of int-based methods in StringUtils > ---------------------------------------------------------------- > > Key: LANG-1300 > URL: https://issues.apache.org/jira/browse/LANG-1300 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* > Affects Versions: 3.5 > Reporter: Duncan Jones > Priority: Minor > Fix For: Discussion > > > The following methods use an {{int}} to represent a search character: > {code:java} > boolean contains(final CharSequence seq, final int searchChar) > int indexOf(final CharSequence seq, final int searchChar) > int indexOf(final CharSequence seq, final int searchChar, final int startPos) > int lastIndexOf(final CharSequence seq, final int searchChar) > int lastIndexOf(final CharSequence seq, final int searchChar, final int startPos) > {code} > When I see an {{int}} representing a character, I tend to assume the method can handle supplementary characters. However, the current behaviour of these methods depends upon whether the {{CharSequence}} is a {{String}} or not. > {code:java} > StringBuilder builder = new StringBuilder(); > builder.appendCodePoint(0x2070E); > System.out.println(StringUtils.lastIndexOf(builder, 0x2070E)); // -1 > System.out.println(StringUtils.lastIndexOf(builder.toString(), 0x2070E)); // 0 > {code} > The Javadoc for these methods are ambiguous on this point, stating: > {quote} > This method uses {{String.lastIndexOf(int)}} if possible. > {quote} > I think we should consider updating the {{CharSequenceUtils}} methods used by this class to convert all {{CharSequence}} parameters to strings, enabling full code point support. The docs could be updated to make this crystal clear. > There is a question of whether this breaks backwards compatibility. -- This message was sent by Atlassian JIRA (v6.3.15#6346)