You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Adriano Crestani <ad...@apache.org> on 2007/10/08 23:42:49 UTC

[SDO C++] DO having no container after removed from a reference list

Hi,

The code above is from DataObjectListImpl.cpp. As far as I know, when a DO
is removed from a non-containment Property, it should not loose its
container. Although, when it's removed from a list it's not checking if the
property is containment or not, it always set the removed DO container as
NULL.

DataObjectPtr DataObjectListImpl::remove(unsigned int index)
{
    validateIndex(index);
    if (container != 0)
    {
        container->logChange(pindex);
    }
    DataObjectPtr d = (*this)[index];

    // log deletion only if the list is of data objects.
    if (theFactory != 0)
    {
        const Type& t = theFactory->getType(typeURI,typeName);
        const Property& p = container->getPropertyFromIndex(pindex);
        if (!t.isDataType() && !p.isReference())
        {
            (getVec()[index])->logDeletion();
        }
    }
    plist.erase(plist.begin()+index);
    DataObject* dob = getRawPointer(d);
    ((DataObjectImpl*)dob)->setContainer(0);  // <<<<<<< should check if is
a contaiment property before execute this operation
    return d;
}

If everything is ok, I will create a jira for that.

Adriano Crestani

RE: [SDO C++] DO having no container after removed from a reference list

Posted by Brady Johnson <Br...@Roguewave.Com>.
Adriano,

This indeed seems to be a bug. Go ahead and write a JIRA please.

Thanks

Best regards,

Brady 

-----Original Message-----
From: adrianocrestani@gmail.com [mailto:adrianocrestani@gmail.com] On
Behalf Of Adriano Crestani
Sent: Monday, October 08, 2007 3:43 PM
To: tuscany-dev@ws.apache.org
Subject: [SDO C++] DO having no container after removed from a reference
list

Hi,

The code above is from DataObjectListImpl.cpp. As far as I know, when a
DO is removed from a non-containment Property, it should not loose its
container. Although, when it's removed from a list it's not checking if
the property is containment or not, it always set the removed DO
container as NULL.

DataObjectPtr DataObjectListImpl::remove(unsigned int index) {
    validateIndex(index);
    if (container != 0)
    {
        container->logChange(pindex);
    }
    DataObjectPtr d = (*this)[index];

    // log deletion only if the list is of data objects.
    if (theFactory != 0)
    {
        const Type& t = theFactory->getType(typeURI,typeName);
        const Property& p = container->getPropertyFromIndex(pindex);
        if (!t.isDataType() && !p.isReference())
        {
            (getVec()[index])->logDeletion();
        }
    }
    plist.erase(plist.begin()+index);
    DataObject* dob = getRawPointer(d);
    ((DataObjectImpl*)dob)->setContainer(0);  // <<<<<<< should check if
is a contaiment property before execute this operation
    return d;
}

If everything is ok, I will create a jira for that.

Adriano Crestani

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org