Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 23377 invoked from network); 3 Jan 2008 12:49:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Jan 2008 12:49:59 -0000 Received: (qmail 15661 invoked by uid 500); 3 Jan 2008 12:49:47 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 15631 invoked by uid 500); 3 Jan 2008 12:49:46 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 15622 invoked by uid 99); 3 Jan 2008 12:49:46 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Jan 2008 04:49:46 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Jan 2008 12:49:43 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 301F77141FE for ; Thu, 3 Jan 2008 04:49:35 -0800 (PST) Message-ID: <33530530.1199364575190.JavaMail.jira@brutus> Date: Thu, 3 Jan 2008 04:49:35 -0800 (PST) From: "Tim Ellison (JIRA)" To: commits@harmony.apache.org Subject: [jira] Closed: (HARMONY-665) [classlib][nio]Charset.encode()/decode() should be more safer for multi thread using MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HARMONY-665?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tim Ellison closed HARMONY-665. ------------------------------- > [classlib][nio]Charset.encode()/decode() should be more safer for multi thread using > ------------------------------------------------------------------------------------ > > Key: HARMONY-665 > URL: https://issues.apache.org/jira/browse/HARMONY-665 > Project: Harmony > Issue Type: Bug > Components: Classlib > Reporter: Paulex Yang > Assignee: Tim Ellison > Attachments: Harmony-665-2.diff, Harmony-665.diff > > > As discussion on the mailing list, current Harmony codes may throw exception for the scenario below: > for (int i = 0; i < THREAD_NUM; i++) { > thread[i] = new Thread() { > public void run() { > sink.write(ByteBuffer.wrap("bytes" > .getBytes(ISO8859_1))); > } > } > String.getBytes() actually invokes Charset.encode(), while spec requires Charset.encode() to be thread-safe. Current Harmony implementation of Charset.encode() holds lock on this Charset instance, but doesn't synchronize on the system wide cached CharsetEncoder, so it is not safe for multi Charset instances in multi threads to encode() concurrently. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.