Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 97309 invoked from network); 24 Nov 2010 07:49:05 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 24 Nov 2010 07:49:05 -0000 Received: (qmail 78494 invoked by uid 500); 24 Nov 2010 07:49:36 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 78384 invoked by uid 500); 24 Nov 2010 07:49:36 -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 78369 invoked by uid 99); 24 Nov 2010 07:49:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Nov 2010 07:49:35 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Nov 2010 07:49:34 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id oAO7nDbg023883 for ; Wed, 24 Nov 2010 07:49:14 GMT Message-ID: <23154183.281871290584953865.JavaMail.jira@thor> Date: Wed, 24 Nov 2010 02:49:13 -0500 (EST) From: "Regis Xu (JIRA)" To: commits@harmony.apache.org Subject: [jira] Commented: (HARMONY-6678) [classlib][concurrent]ArrayIndexOutofBounds exception reported in ConcurrentSkipListSet during load test In-Reply-To: <6679479.169381290060373578.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HARMONY-6678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12935239#action_12935239 ] Regis Xu commented on HARMONY-6678: ----------------------------------- For patch 002_HARMONY_6678.patch: while (iterator.hasNext()) { if (index == toArray.length) { toArray = trimOrAppend(toArray, toArray.length * 2 + 1); } for (; index < toArray.length; index++) { if (!iterator.hasNext()) { return trimOrAppend(toArray, index); } toArray[index] = iterator.next(); } } Could the two level loops be simplified to one level? toArray(T[]) invoke toArray(), that make toArray(T[]) gets one more array copy operation than toArray(), I think generalizing trimOrAppend, and both toArray() and toArray(T[]) use it can reduce the extra copy. > [classlib][concurrent]ArrayIndexOutofBounds exception reported in ConcurrentSkipListSet during load test > -------------------------------------------------------------------------------------------------------- > > Key: HARMONY-6678 > URL: https://issues.apache.org/jira/browse/HARMONY-6678 > Project: Harmony > Issue Type: Bug > Components: Classlib > Affects Versions: 6.0M3 > Environment: All Operating Systems > Reporter: Prashanth KS > Fix For: 6.0M3 > > Attachments: 001_HARMONY_6678.patch, 002_HARMONY_6678.patch > > > An ArrayIndexOutofBoundsException is thrown when the toArray(T[]) method is invoked, under load test with multiple threads. Concurrent updates to the collection results in changing Iterator sizes. As per the Javadocs, the result of the toArray(T[]) should return as much elements possible from the Collection. > A toArray(T[]) method override has been implemented in ConcurrentSkipListSet and the bounds check has been included in the base class AbstractCollection to prevent this exception. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.