Is this already in CVS? This fix is correct?

Thanks,

Edson Richter

> After some research, I've found an implementation that works:
>
>     public void clear()
>     {
>         Collection coll;
>
>         if(getData()instanceof ManageableCollection) {
>           getData().clear(); // ECER: assure it will notify all being
> removed, necessary for RemovalAware classes...
>         } else {
> // BRJ: use an empty collection so isLoaded will return true
>         try
>         {
>             coll = (Collection) getCollectionClass().newInstance();
>         }
>         catch (Exception e)
>         {
>             coll = new ArrayList();
>         }
>         setData(coll);
>         _size = 0;
>         }
>     }
>
>
> Could someone cofirm/fix this in CVS?
>
> Thanks,
>
> Edson Richter
>
>
> Edson Carlos Ericksson Richter wrote:
>
>> I think I and a co-worker (Igor) found a little bug  in collection
>> proxy. When using RemovalAware... as class for a collection
>> descriptor, calling clear() in the collection don't register the
>> objects for deletion. The answer is the clear implementation in
>> CollectionProxyDefaultImpl:
>>
>>    public void clear()
>>    {
>>        Collection coll;
>>
>> // BRJ: use an empty collection so isLoaded will return true
>>        try
>>        {
>>            coll = (Collection) getCollectionClass().newInstance();
>>        }
>>        catch (Exception e)
>>        {
>>            coll = new ArrayList();
>>        }
>>        setData(coll);
>>        _size = 0;
>>
>>    }
>>
>> I think the right method should be:
>>
>>    public void clear()
>>    {
>>        Collection coll;
>>        getData().clear(); // ECER: assure it will notify all being
>> removed, necessary for RemovalAware classes...
>>
>> // BRJ: use an empty collection so isLoaded will return true
>>        try
>>        {
>>            coll = (Collection) getCollectionClass().newInstance();
>>        }
>>        catch (Exception e)
>>        {
>>            coll = new ArrayList();
>>        }
>>        setData(coll);
>>        _size = 0;
>>
>>    }
>>
>> Could you analize and report if this is right?
>>
>> Thanks,
>>
>> Edson Richter
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to