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 6D3DE70CF for ; Fri, 5 Aug 2011 13:29:52 +0000 (UTC) Received: (qmail 42404 invoked by uid 500); 5 Aug 2011 13:29:52 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 42334 invoked by uid 500); 5 Aug 2011 13:29:51 -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 42326 invoked by uid 99); 5 Aug 2011 13:29:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Aug 2011 13:29:51 +0000 X-ASF-Spam-Status: No, hits=-2000.7 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, 05 Aug 2011 13:29: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 1AFE7A9F0C for ; Fri, 5 Aug 2011 13:29:27 +0000 (UTC) Date: Fri, 5 Aug 2011 13:29:27 +0000 (UTC) From: "Matt Benson (JIRA)" To: issues@commons.apache.org Message-ID: <1669651421.11561.1312550967106.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <321524515.2234.1312309227136.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (LANG-736) CharUtils static final array CHAR_STRING is not needed to compute CHAR_STRING_ARRAY 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-736?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13079966#comment-13079966 ] Matt Benson commented on LANG-736: ---------------------------------- Actually, I read the report as "the *current* lang code relies on a Sun feature, and should be changed." > CharUtils static final array CHAR_STRING is not needed to compute CHAR_STRING_ARRAY > ----------------------------------------------------------------------------------- > > Key: LANG-736 > URL: https://issues.apache.org/jira/browse/LANG-736 > Project: Commons Lang > Issue Type: Bug > Components: lang.* > Affects Versions: 3.0 > Reporter: Gary D. Gregory > Assignee: Gary D. Gregory > Fix For: 3.0.2 > > Attachments: lang-736.diff > > > CharUtils static final array CHAR_STRING is not needed to compute CHAR_STRING_ARRAY. > This: > {code:java} > private static final String CHAR_STRING = > "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + > "\b\t\n\u000b\f\r\u000e\u000f" + > "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + > "\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f" + > "\u0020\u0021\"\u0023\u0024\u0025\u0026\u0027" + > "\u0028\u0029\u002a\u002b\u002c\u002d\u002e\u002f" + > "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + > "\u0038\u0039\u003a\u003b\u003c\u003d\u003e\u003f" + > "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + > "\u0048\u0049\u004a\u004b\u004c\u004d\u004e\u004f" + > "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + > "\u0058\u0059\u005a\u005b\\\u005d\u005e\u005f" + > "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + > "\u0068\u0069\u006a\u006b\u006c\u006d\u006e\u006f" + > "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + > "\u0078\u0079\u007a\u007b\u007c\u007d\u007e\u007f"; > // snip > for (int i = 127; i >= 0; i--) { > CHAR_STRING_ARRAY[i] = CHAR_STRING.substring(i, i + 1); > } > {code} > Can be recoded as: > {code:java} > for (char c = 0; c < CHAR_STRING_ARRAY.length; c++) { > CHAR_STRING_ARRAY[c] = String.valueOf(c); > } > {code} > With the lang 3.0 code, using the Oracle Java 5 String impl, the 128 Strings share the underlying CHAR_STRING char[] because of the way Sun implemented String#substring(int,int). > The proposed implementation does not reply on this private implementation detail but creates one char[1] array per String. > Thoughts? -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira