harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Regis Xu (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-6678) [classlib][concurrent]ArrayIndexOutofBounds exception reported in ConcurrentSkipListSet during load test
Date Wed, 24 Nov 2010 07:49:13 GMT

    [ 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.

View raw message