You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Ron Gavlin (JIRA)" <tu...@ws.apache.org> on 2007/07/26 23:06:04 UTC

[jira] Created: (TUSCANY-1484) StackOverflowException invoking isSet on a static DataObject with a dynamically-added property

StackOverflowException invoking isSet on a static DataObject with a dynamically-added property
----------------------------------------------------------------------------------------------

                 Key: TUSCANY-1484
                 URL: https://issues.apache.org/jira/browse/TUSCANY-1484
             Project: Tuscany
          Issue Type: Bug
          Components: Java SDO Implementation
    Affects Versions: Java-SDO-Next
            Reporter: Ron Gavlin


I have a Type and a corresponding statically-generated class. At runtime, I dynamically add an add'l Property to this Type using SDOUtil.createProperty(). Then, when I invoke dataObjectInstance.isSet(dynamicallyAddedProperty), the  StackOverflowException listed below is generated:

> java.lang.StackOverflowError
> at mypackage.impl.MyFactoryImpl.getMyType(MyFactoryImpl.java:1135)
>
>
> at mypackage.impl.MyTypeImpl.getStaticType(MyTypeImpl.java:821)
> at org.apache.tuscany.sdo.impl.DataObjectBase.
> eStaticClass(DataObjectBase.java:378)
> at org.apache.tuscany.sdo.impl.ExtensibleDataObjectImpl.
> eClass(ExtensibleDataObjectImpl.java:118)
> at org.apache.tuscany.sdo.impl.ExtensibleDataObjectImpl.
> eDerivedStructuralFeatureID(ExtensibleDataObjectImlp.java:87)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.
> eIsSet(BasicEObjectimpl.java:815)
>
> at
org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DataObjectImpl.java:152)
>
> at
org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DatObjectImpl.java:112)
>
> at mypackage.sdo.impl.MyTypeImpl.setSet(MyTypeImpl.java:2005)
>
>
> at
org.apache.tuscany.sdo.impl.DataObjectBase.eIsSet(DataObjectBase.java:437)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.
> eIsSet(BasicEObjectimpl.java:818)
> at
org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DataObjectImpl.java:152)
> at
org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DatObjectImpl.java:112)
> ...
> at mypackage.sdo.impl.MyTypeImpl.setSet(MyTypeImpl.java:2005)
>
> at
org.apache.tuscany.sdo.impl.DataObjectBase.eIsSet(DataObjectBase.java:437)
>
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.
> eIsSet(BasicEObjectimpl.java:818)
>
> at
org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DataObjectImpl.java:152)
>
> at
org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DatObjectImpl.java:112)
>
> ...
>

Frank's characterization of the problem is included below.

----- Original Message ----
From: Frank Budinsky <fr...@ca.ibm.com>
To: tuscany-user@ws.apache.org
Sent: Thursday, July 26, 2007 3:03:15 PM
Subject: Re: How to add Property to an XSDHelper-defined Type

Since the properties start at 0, the extra property number should be equal
to INTERNAL_PROPERTY_COUNT. That looks right.

The StackOverflowException problem looks to me to be caused by the fact
that the generated methods like isSet(int) are expected to find the
property and only call super in the dynamic case. In your case, the
property isn't statically handled, so it eventually calls
DataObjectBase.eIsSet():

  public boolean eIsSet(int featureID)
  {
    if (isDynamic())
    {
      return super.eIsSet(internalConvertIndex(featureID));
    } else
    {
      return isSet(internalConvertIndex(featureID));
    }
  }

which will recursively call isSet() again because isDynamic() returns
false. Somehow the code needs to be changed so that the dynamic property
also causes it to go down the isDynamic() path.

Actually, this eIsSet() method looks fishy to me regardless. First, the
call to internalConvertIndex(featureID) for the call to super.eIsSet()
looks wrong to me. I think it should be just featureID. The super call is
expecting the internal (EMF) number, not the converted SDO number. Second,
even in the dynamic sublass case (which this is supposed to be handling, I
think that a client call to eIsSet() won't work, because it won't ever go
down the isSet() patch which handles the static properties (in the base
class(es)).

I think the isDynamic() part of this method should be removed and instead
there should be an implementation of isSet(int) (in ExtensibleDataObject
probably?) that handles the case of a property that is either in a dynamic
sublass or was dynamically added to a static type.

Frank.


Ron Gavlin <rg...@yahoo.com> wrote on 07/26/2007 01:09:27 PM:

> Frank,
>
> This scenario appears to trigger a property-indexing problem. The
> newly added property's EMF featureID of 18 equals the value of
> MyTypeImpl.SDO_PROPERTY_COUNT and MyTypeImpl.
> INTERNAL_PROPERTY_COUNT. This appears to cause an infinite loop. Any
> ideas for working around this problem?
>
> - Ron
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Resolved: (TUSCANY-1484) StackOverflowException invoking isSet on a static DataObject with a dynamically-added property

Posted by "Kelvin Goodson (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1484?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kelvin Goodson resolved TUSCANY-1484.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: Java-SDO-Next

Applied patch,  thanks Ron!

> StackOverflowException invoking isSet on a static DataObject with a dynamically-added property
> ----------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1484
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1484
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>             Fix For: Java-SDO-Next
>
>         Attachments: tuscany-sdo.TUSCANY-1484.patch
>
>
> I have a Type and a corresponding statically-generated class. At runtime, I dynamically add an add'l Property to this Type using SDOUtil.createProperty(). Then, when I invoke dataObjectInstance.isSet(dynamicallyAddedProperty), the  StackOverflowException listed below is generated:
> > java.lang.StackOverflowError
> > at mypackage.impl.MyFactoryImpl.getMyType(MyFactoryImpl.java:1135)
> >
> >
> > at mypackage.impl.MyTypeImpl.getStaticType(MyTypeImpl.java:821)
> > at org.apache.tuscany.sdo.impl.DataObjectBase.
> > eStaticClass(DataObjectBase.java:378)
> > at org.apache.tuscany.sdo.impl.ExtensibleDataObjectImpl.
> > eClass(ExtensibleDataObjectImpl.java:118)
> > at org.apache.tuscany.sdo.impl.ExtensibleDataObjectImpl.
> > eDerivedStructuralFeatureID(ExtensibleDataObjectImlp.java:87)
> > at org.eclipse.emf.ecore.impl.BasicEObjectImpl.
> > eIsSet(BasicEObjectimpl.java:815)
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DataObjectImpl.java:152)
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DatObjectImpl.java:112)
> >
> > at mypackage.sdo.impl.MyTypeImpl.setSet(MyTypeImpl.java:2005)
> >
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectBase.eIsSet(DataObjectBase.java:437)
> > at org.eclipse.emf.ecore.impl.BasicEObjectImpl.
> > eIsSet(BasicEObjectimpl.java:818)
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DataObjectImpl.java:152)
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DatObjectImpl.java:112)
> > ...
> > at mypackage.sdo.impl.MyTypeImpl.setSet(MyTypeImpl.java:2005)
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectBase.eIsSet(DataObjectBase.java:437)
> >
> > at org.eclipse.emf.ecore.impl.BasicEObjectImpl.
> > eIsSet(BasicEObjectimpl.java:818)
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DataObjectImpl.java:152)
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DatObjectImpl.java:112)
> >
> > ...
> >
> Frank's characterization of the problem is included below.
> ----- Original Message ----
> From: Frank Budinsky <fr...@ca.ibm.com>
> To: tuscany-user@ws.apache.org
> Sent: Thursday, July 26, 2007 3:03:15 PM
> Subject: Re: How to add Property to an XSDHelper-defined Type
> Since the properties start at 0, the extra property number should be equal
> to INTERNAL_PROPERTY_COUNT. That looks right.
> The StackOverflowException problem looks to me to be caused by the fact
> that the generated methods like isSet(int) are expected to find the
> property and only call super in the dynamic case. In your case, the
> property isn't statically handled, so it eventually calls
> DataObjectBase.eIsSet():
>   public boolean eIsSet(int featureID)
>   {
>     if (isDynamic())
>     {
>       return super.eIsSet(internalConvertIndex(featureID));
>     } else
>     {
>       return isSet(internalConvertIndex(featureID));
>     }
>   }
> which will recursively call isSet() again because isDynamic() returns
> false. Somehow the code needs to be changed so that the dynamic property
> also causes it to go down the isDynamic() path.
> Actually, this eIsSet() method looks fishy to me regardless. First, the
> call to internalConvertIndex(featureID) for the call to super.eIsSet()
> looks wrong to me. I think it should be just featureID. The super call is
> expecting the internal (EMF) number, not the converted SDO number. Second,
> even in the dynamic sublass case (which this is supposed to be handling, I
> think that a client call to eIsSet() won't work, because it won't ever go
> down the isSet() patch which handles the static properties (in the base
> class(es)).
> I think the isDynamic() part of this method should be removed and instead
> there should be an implementation of isSet(int) (in ExtensibleDataObject
> probably?) that handles the case of a property that is either in a dynamic
> sublass or was dynamically added to a static type.
> Frank.
> Ron Gavlin <rg...@yahoo.com> wrote on 07/26/2007 01:09:27 PM:
> > Frank,
> >
> > This scenario appears to trigger a property-indexing problem. The
> > newly added property's EMF featureID of 18 equals the value of
> > MyTypeImpl.SDO_PROPERTY_COUNT and MyTypeImpl.
> > INTERNAL_PROPERTY_COUNT. This appears to cause an infinite loop. Any
> > ideas for working around this problem?
> >
> > - Ron
> >

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (TUSCANY-1484) StackOverflowException invoking isSet on a static DataObject with a dynamically-added property

Posted by "Amita Vadhavkar (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1484?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Amita Vadhavkar updated TUSCANY-1484:
-------------------------------------

    Fix Version/s:     (was: Java-SDO-Next)
                   Java-SDO-1.1

> StackOverflowException invoking isSet on a static DataObject with a dynamically-added property
> ----------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1484
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1484
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>             Fix For: Java-SDO-1.1
>
>         Attachments: tuscany-sdo.TUSCANY-1484.patch
>
>
> I have a Type and a corresponding statically-generated class. At runtime, I dynamically add an add'l Property to this Type using SDOUtil.createProperty(). Then, when I invoke dataObjectInstance.isSet(dynamicallyAddedProperty), the  StackOverflowException listed below is generated:
> > java.lang.StackOverflowError
> > at mypackage.impl.MyFactoryImpl.getMyType(MyFactoryImpl.java:1135)
> >
> >
> > at mypackage.impl.MyTypeImpl.getStaticType(MyTypeImpl.java:821)
> > at org.apache.tuscany.sdo.impl.DataObjectBase.
> > eStaticClass(DataObjectBase.java:378)
> > at org.apache.tuscany.sdo.impl.ExtensibleDataObjectImpl.
> > eClass(ExtensibleDataObjectImpl.java:118)
> > at org.apache.tuscany.sdo.impl.ExtensibleDataObjectImpl.
> > eDerivedStructuralFeatureID(ExtensibleDataObjectImlp.java:87)
> > at org.eclipse.emf.ecore.impl.BasicEObjectImpl.
> > eIsSet(BasicEObjectimpl.java:815)
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DataObjectImpl.java:152)
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DatObjectImpl.java:112)
> >
> > at mypackage.sdo.impl.MyTypeImpl.setSet(MyTypeImpl.java:2005)
> >
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectBase.eIsSet(DataObjectBase.java:437)
> > at org.eclipse.emf.ecore.impl.BasicEObjectImpl.
> > eIsSet(BasicEObjectimpl.java:818)
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DataObjectImpl.java:152)
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DatObjectImpl.java:112)
> > ...
> > at mypackage.sdo.impl.MyTypeImpl.setSet(MyTypeImpl.java:2005)
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectBase.eIsSet(DataObjectBase.java:437)
> >
> > at org.eclipse.emf.ecore.impl.BasicEObjectImpl.
> > eIsSet(BasicEObjectimpl.java:818)
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DataObjectImpl.java:152)
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DatObjectImpl.java:112)
> >
> > ...
> >
> Frank's characterization of the problem is included below.
> ----- Original Message ----
> From: Frank Budinsky <fr...@ca.ibm.com>
> To: tuscany-user@ws.apache.org
> Sent: Thursday, July 26, 2007 3:03:15 PM
> Subject: Re: How to add Property to an XSDHelper-defined Type
> Since the properties start at 0, the extra property number should be equal
> to INTERNAL_PROPERTY_COUNT. That looks right.
> The StackOverflowException problem looks to me to be caused by the fact
> that the generated methods like isSet(int) are expected to find the
> property and only call super in the dynamic case. In your case, the
> property isn't statically handled, so it eventually calls
> DataObjectBase.eIsSet():
>   public boolean eIsSet(int featureID)
>   {
>     if (isDynamic())
>     {
>       return super.eIsSet(internalConvertIndex(featureID));
>     } else
>     {
>       return isSet(internalConvertIndex(featureID));
>     }
>   }
> which will recursively call isSet() again because isDynamic() returns
> false. Somehow the code needs to be changed so that the dynamic property
> also causes it to go down the isDynamic() path.
> Actually, this eIsSet() method looks fishy to me regardless. First, the
> call to internalConvertIndex(featureID) for the call to super.eIsSet()
> looks wrong to me. I think it should be just featureID. The super call is
> expecting the internal (EMF) number, not the converted SDO number. Second,
> even in the dynamic sublass case (which this is supposed to be handling, I
> think that a client call to eIsSet() won't work, because it won't ever go
> down the isSet() patch which handles the static properties (in the base
> class(es)).
> I think the isDynamic() part of this method should be removed and instead
> there should be an implementation of isSet(int) (in ExtensibleDataObject
> probably?) that handles the case of a property that is either in a dynamic
> sublass or was dynamically added to a static type.
> Frank.
> Ron Gavlin <rg...@yahoo.com> wrote on 07/26/2007 01:09:27 PM:
> > Frank,
> >
> > This scenario appears to trigger a property-indexing problem. The
> > newly added property's EMF featureID of 18 equals the value of
> > MyTypeImpl.SDO_PROPERTY_COUNT and MyTypeImpl.
> > INTERNAL_PROPERTY_COUNT. This appears to cause an infinite loop. Any
> > ideas for working around this problem?
> >
> > - Ron
> >

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (TUSCANY-1484) StackOverflowException invoking isSet on a static DataObject with a dynamically-added property

Posted by "Ron Gavlin (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12516146 ] 

Ron Gavlin commented on TUSCANY-1484:
-------------------------------------

Please add the following test which exposes the problem to source file: tools/src/test/java/org/apache/tuscany/sdo/test/ExtensibleTestCase.java.

Thanks,

- Ron

    public void testIsSetForPropertyDynamicallyAddedToStaticType() throws IOException {
        Type customersType = scope.getTypeHelper().getType(CustomersType.class);
        Type zipcodeInfoType = scope.getTypeHelper().getType(
                "http://www.example.com/extensible/info/zipcode", "InfoType");
        Property zipcodeInfoProperty = SDOUtil.createProperty(customersType, "zipcodeInfo", zipcodeInfoType);
        XMLDocument doc = scope.getXMLHelper().load(
                getClass().getResourceAsStream(CUSTOMERS_XML));
        assertFalse(doc.getRootObject().isSet(zipcodeInfoProperty));
    }


> StackOverflowException invoking isSet on a static DataObject with a dynamically-added property
> ----------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1484
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1484
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>
> I have a Type and a corresponding statically-generated class. At runtime, I dynamically add an add'l Property to this Type using SDOUtil.createProperty(). Then, when I invoke dataObjectInstance.isSet(dynamicallyAddedProperty), the  StackOverflowException listed below is generated:
> > java.lang.StackOverflowError
> > at mypackage.impl.MyFactoryImpl.getMyType(MyFactoryImpl.java:1135)
> >
> >
> > at mypackage.impl.MyTypeImpl.getStaticType(MyTypeImpl.java:821)
> > at org.apache.tuscany.sdo.impl.DataObjectBase.
> > eStaticClass(DataObjectBase.java:378)
> > at org.apache.tuscany.sdo.impl.ExtensibleDataObjectImpl.
> > eClass(ExtensibleDataObjectImpl.java:118)
> > at org.apache.tuscany.sdo.impl.ExtensibleDataObjectImpl.
> > eDerivedStructuralFeatureID(ExtensibleDataObjectImlp.java:87)
> > at org.eclipse.emf.ecore.impl.BasicEObjectImpl.
> > eIsSet(BasicEObjectimpl.java:815)
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DataObjectImpl.java:152)
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DatObjectImpl.java:112)
> >
> > at mypackage.sdo.impl.MyTypeImpl.setSet(MyTypeImpl.java:2005)
> >
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectBase.eIsSet(DataObjectBase.java:437)
> > at org.eclipse.emf.ecore.impl.BasicEObjectImpl.
> > eIsSet(BasicEObjectimpl.java:818)
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DataObjectImpl.java:152)
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DatObjectImpl.java:112)
> > ...
> > at mypackage.sdo.impl.MyTypeImpl.setSet(MyTypeImpl.java:2005)
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectBase.eIsSet(DataObjectBase.java:437)
> >
> > at org.eclipse.emf.ecore.impl.BasicEObjectImpl.
> > eIsSet(BasicEObjectimpl.java:818)
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DataObjectImpl.java:152)
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DatObjectImpl.java:112)
> >
> > ...
> >
> Frank's characterization of the problem is included below.
> ----- Original Message ----
> From: Frank Budinsky <fr...@ca.ibm.com>
> To: tuscany-user@ws.apache.org
> Sent: Thursday, July 26, 2007 3:03:15 PM
> Subject: Re: How to add Property to an XSDHelper-defined Type
> Since the properties start at 0, the extra property number should be equal
> to INTERNAL_PROPERTY_COUNT. That looks right.
> The StackOverflowException problem looks to me to be caused by the fact
> that the generated methods like isSet(int) are expected to find the
> property and only call super in the dynamic case. In your case, the
> property isn't statically handled, so it eventually calls
> DataObjectBase.eIsSet():
>   public boolean eIsSet(int featureID)
>   {
>     if (isDynamic())
>     {
>       return super.eIsSet(internalConvertIndex(featureID));
>     } else
>     {
>       return isSet(internalConvertIndex(featureID));
>     }
>   }
> which will recursively call isSet() again because isDynamic() returns
> false. Somehow the code needs to be changed so that the dynamic property
> also causes it to go down the isDynamic() path.
> Actually, this eIsSet() method looks fishy to me regardless. First, the
> call to internalConvertIndex(featureID) for the call to super.eIsSet()
> looks wrong to me. I think it should be just featureID. The super call is
> expecting the internal (EMF) number, not the converted SDO number. Second,
> even in the dynamic sublass case (which this is supposed to be handling, I
> think that a client call to eIsSet() won't work, because it won't ever go
> down the isSet() patch which handles the static properties (in the base
> class(es)).
> I think the isDynamic() part of this method should be removed and instead
> there should be an implementation of isSet(int) (in ExtensibleDataObject
> probably?) that handles the case of a property that is either in a dynamic
> sublass or was dynamically added to a static type.
> Frank.
> Ron Gavlin <rg...@yahoo.com> wrote on 07/26/2007 01:09:27 PM:
> > Frank,
> >
> > This scenario appears to trigger a property-indexing problem. The
> > newly added property's EMF featureID of 18 equals the value of
> > MyTypeImpl.SDO_PROPERTY_COUNT and MyTypeImpl.
> > INTERNAL_PROPERTY_COUNT. This appears to cause an infinite loop. Any
> > ideas for working around this problem?
> >
> > - Ron
> >

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (TUSCANY-1484) StackOverflowException invoking isSet on a static DataObject with a dynamically-added property

Posted by "Ron Gavlin (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1484?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ron Gavlin updated TUSCANY-1484:
--------------------------------

    Patch Info: [Patch Available]

> StackOverflowException invoking isSet on a static DataObject with a dynamically-added property
> ----------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1484
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1484
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>         Attachments: tuscany-sdo.TUSCANY-1484.patch
>
>
> I have a Type and a corresponding statically-generated class. At runtime, I dynamically add an add'l Property to this Type using SDOUtil.createProperty(). Then, when I invoke dataObjectInstance.isSet(dynamicallyAddedProperty), the  StackOverflowException listed below is generated:
> > java.lang.StackOverflowError
> > at mypackage.impl.MyFactoryImpl.getMyType(MyFactoryImpl.java:1135)
> >
> >
> > at mypackage.impl.MyTypeImpl.getStaticType(MyTypeImpl.java:821)
> > at org.apache.tuscany.sdo.impl.DataObjectBase.
> > eStaticClass(DataObjectBase.java:378)
> > at org.apache.tuscany.sdo.impl.ExtensibleDataObjectImpl.
> > eClass(ExtensibleDataObjectImpl.java:118)
> > at org.apache.tuscany.sdo.impl.ExtensibleDataObjectImpl.
> > eDerivedStructuralFeatureID(ExtensibleDataObjectImlp.java:87)
> > at org.eclipse.emf.ecore.impl.BasicEObjectImpl.
> > eIsSet(BasicEObjectimpl.java:815)
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DataObjectImpl.java:152)
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DatObjectImpl.java:112)
> >
> > at mypackage.sdo.impl.MyTypeImpl.setSet(MyTypeImpl.java:2005)
> >
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectBase.eIsSet(DataObjectBase.java:437)
> > at org.eclipse.emf.ecore.impl.BasicEObjectImpl.
> > eIsSet(BasicEObjectimpl.java:818)
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DataObjectImpl.java:152)
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DatObjectImpl.java:112)
> > ...
> > at mypackage.sdo.impl.MyTypeImpl.setSet(MyTypeImpl.java:2005)
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectBase.eIsSet(DataObjectBase.java:437)
> >
> > at org.eclipse.emf.ecore.impl.BasicEObjectImpl.
> > eIsSet(BasicEObjectimpl.java:818)
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DataObjectImpl.java:152)
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DatObjectImpl.java:112)
> >
> > ...
> >
> Frank's characterization of the problem is included below.
> ----- Original Message ----
> From: Frank Budinsky <fr...@ca.ibm.com>
> To: tuscany-user@ws.apache.org
> Sent: Thursday, July 26, 2007 3:03:15 PM
> Subject: Re: How to add Property to an XSDHelper-defined Type
> Since the properties start at 0, the extra property number should be equal
> to INTERNAL_PROPERTY_COUNT. That looks right.
> The StackOverflowException problem looks to me to be caused by the fact
> that the generated methods like isSet(int) are expected to find the
> property and only call super in the dynamic case. In your case, the
> property isn't statically handled, so it eventually calls
> DataObjectBase.eIsSet():
>   public boolean eIsSet(int featureID)
>   {
>     if (isDynamic())
>     {
>       return super.eIsSet(internalConvertIndex(featureID));
>     } else
>     {
>       return isSet(internalConvertIndex(featureID));
>     }
>   }
> which will recursively call isSet() again because isDynamic() returns
> false. Somehow the code needs to be changed so that the dynamic property
> also causes it to go down the isDynamic() path.
> Actually, this eIsSet() method looks fishy to me regardless. First, the
> call to internalConvertIndex(featureID) for the call to super.eIsSet()
> looks wrong to me. I think it should be just featureID. The super call is
> expecting the internal (EMF) number, not the converted SDO number. Second,
> even in the dynamic sublass case (which this is supposed to be handling, I
> think that a client call to eIsSet() won't work, because it won't ever go
> down the isSet() patch which handles the static properties (in the base
> class(es)).
> I think the isDynamic() part of this method should be removed and instead
> there should be an implementation of isSet(int) (in ExtensibleDataObject
> probably?) that handles the case of a property that is either in a dynamic
> sublass or was dynamically added to a static type.
> Frank.
> Ron Gavlin <rg...@yahoo.com> wrote on 07/26/2007 01:09:27 PM:
> > Frank,
> >
> > This scenario appears to trigger a property-indexing problem. The
> > newly added property's EMF featureID of 18 equals the value of
> > MyTypeImpl.SDO_PROPERTY_COUNT and MyTypeImpl.
> > INTERNAL_PROPERTY_COUNT. This appears to cause an infinite loop. Any
> > ideas for working around this problem?
> >
> > - Ron
> >

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (TUSCANY-1484) StackOverflowException invoking isSet on a static DataObject with a dynamically-added property

Posted by "Ron Gavlin (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1484?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ron Gavlin updated TUSCANY-1484:
--------------------------------

    Attachment: tuscany-sdo.TUSCANY-1484.patch

This patch includes an add'l test in tools/.../ExtensibleTestCase that exposes the bug. It also includes modifications to impl classes to fix the bug.

> StackOverflowException invoking isSet on a static DataObject with a dynamically-added property
> ----------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1484
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1484
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>         Attachments: tuscany-sdo.TUSCANY-1484.patch
>
>
> I have a Type and a corresponding statically-generated class. At runtime, I dynamically add an add'l Property to this Type using SDOUtil.createProperty(). Then, when I invoke dataObjectInstance.isSet(dynamicallyAddedProperty), the  StackOverflowException listed below is generated:
> > java.lang.StackOverflowError
> > at mypackage.impl.MyFactoryImpl.getMyType(MyFactoryImpl.java:1135)
> >
> >
> > at mypackage.impl.MyTypeImpl.getStaticType(MyTypeImpl.java:821)
> > at org.apache.tuscany.sdo.impl.DataObjectBase.
> > eStaticClass(DataObjectBase.java:378)
> > at org.apache.tuscany.sdo.impl.ExtensibleDataObjectImpl.
> > eClass(ExtensibleDataObjectImpl.java:118)
> > at org.apache.tuscany.sdo.impl.ExtensibleDataObjectImpl.
> > eDerivedStructuralFeatureID(ExtensibleDataObjectImlp.java:87)
> > at org.eclipse.emf.ecore.impl.BasicEObjectImpl.
> > eIsSet(BasicEObjectimpl.java:815)
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DataObjectImpl.java:152)
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DatObjectImpl.java:112)
> >
> > at mypackage.sdo.impl.MyTypeImpl.setSet(MyTypeImpl.java:2005)
> >
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectBase.eIsSet(DataObjectBase.java:437)
> > at org.eclipse.emf.ecore.impl.BasicEObjectImpl.
> > eIsSet(BasicEObjectimpl.java:818)
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DataObjectImpl.java:152)
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DatObjectImpl.java:112)
> > ...
> > at mypackage.sdo.impl.MyTypeImpl.setSet(MyTypeImpl.java:2005)
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectBase.eIsSet(DataObjectBase.java:437)
> >
> > at org.eclipse.emf.ecore.impl.BasicEObjectImpl.
> > eIsSet(BasicEObjectimpl.java:818)
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DataObjectImpl.java:152)
> >
> > at
> org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DatObjectImpl.java:112)
> >
> > ...
> >
> Frank's characterization of the problem is included below.
> ----- Original Message ----
> From: Frank Budinsky <fr...@ca.ibm.com>
> To: tuscany-user@ws.apache.org
> Sent: Thursday, July 26, 2007 3:03:15 PM
> Subject: Re: How to add Property to an XSDHelper-defined Type
> Since the properties start at 0, the extra property number should be equal
> to INTERNAL_PROPERTY_COUNT. That looks right.
> The StackOverflowException problem looks to me to be caused by the fact
> that the generated methods like isSet(int) are expected to find the
> property and only call super in the dynamic case. In your case, the
> property isn't statically handled, so it eventually calls
> DataObjectBase.eIsSet():
>   public boolean eIsSet(int featureID)
>   {
>     if (isDynamic())
>     {
>       return super.eIsSet(internalConvertIndex(featureID));
>     } else
>     {
>       return isSet(internalConvertIndex(featureID));
>     }
>   }
> which will recursively call isSet() again because isDynamic() returns
> false. Somehow the code needs to be changed so that the dynamic property
> also causes it to go down the isDynamic() path.
> Actually, this eIsSet() method looks fishy to me regardless. First, the
> call to internalConvertIndex(featureID) for the call to super.eIsSet()
> looks wrong to me. I think it should be just featureID. The super call is
> expecting the internal (EMF) number, not the converted SDO number. Second,
> even in the dynamic sublass case (which this is supposed to be handling, I
> think that a client call to eIsSet() won't work, because it won't ever go
> down the isSet() patch which handles the static properties (in the base
> class(es)).
> I think the isDynamic() part of this method should be removed and instead
> there should be an implementation of isSet(int) (in ExtensibleDataObject
> probably?) that handles the case of a property that is either in a dynamic
> sublass or was dynamically added to a static type.
> Frank.
> Ron Gavlin <rg...@yahoo.com> wrote on 07/26/2007 01:09:27 PM:
> > Frank,
> >
> > This scenario appears to trigger a property-indexing problem. The
> > newly added property's EMF featureID of 18 equals the value of
> > MyTypeImpl.SDO_PROPERTY_COUNT and MyTypeImpl.
> > INTERNAL_PROPERTY_COUNT. This appears to cause an infinite loop. Any
> > ideas for working around this problem?
> >
> > - Ron
> >

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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