Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 92835 invoked from network); 26 Jun 2006 11:41:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 26 Jun 2006 11:41:03 -0000 Received: (qmail 91625 invoked by uid 500); 26 Jun 2006 11:41:03 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 91593 invoked by uid 500); 26 Jun 2006 11:41:03 -0000 Mailing-List: contact harmony-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-commits@incubator.apache.org Received: (qmail 91580 invoked by uid 99); 26 Jun 2006 11:41:03 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Jun 2006 04:41:03 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [209.237.227.198] (HELO brutus.apache.org) (209.237.227.198) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Jun 2006 04:41:02 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 3A15B410007 for ; Mon, 26 Jun 2006 11:39:30 +0000 (GMT) Message-ID: <10927366.1151321970219.JavaMail.jira@brutus> Date: Mon, 26 Jun 2006 11:39:30 +0000 (GMT+00:00) From: "George Harley (JIRA)" To: harmony-commits@incubator.apache.org Subject: [jira] Assigned: (HARMONY-665) [classlib][nio]Charset.encode()/decode() should be more safer for multi thread using In-Reply-To: <20662170.1151318909787.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/HARMONY-665?page=all ] George Harley reassigned HARMONY-665: ------------------------------------- Assign To: George Harley > [classlib][nio]Charset.encode()/decode() should be more safer for multi thread using > ------------------------------------------------------------------------------------ > > Key: HARMONY-665 > URL: http://issues.apache.org/jira/browse/HARMONY-665 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Paulex Yang > Assignee: George Harley > Attachments: 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. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira