You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Yang ZHONG <le...@gmail.com> on 2007/01/29 23:11:37 UTC

Re: java.lang.ClassCastException org.eclipse.emf.ecore.util.EcoreEList$Dynamicincompatible with commonj.sdo.DataObject

Maybe the exception isn't from getList.

For class casting such as "(expectation)actualClassInstance",
the exception looks like "actualClass incompatible with expectation".
I guess the exception is from "(DataObject)value" such as getDataObject. So
in the mentioned sample:
1.        DataObject items = purchaseOrder.getDataObject("items");
2.        List itemList = items.getList("item");
the exception may come from line 1 instead of line 2.




On 1/29/07, Christian Landbo Frederiksen <
Christian.Landbo.Frederiksen@ementor.dk> wrote:
>
>
> It is Many:
>
> The thing it that is was during an analysis of a schema and the 'Many'
> property was not set in the DataObject.
> When dealing with a not 'many' property the get-method just returns null
> but when dealing with a 'many' property the getList resulted in the
> mentioned ClassCastException.
>
> Now I avoid it by checking for dataObject.isSet(p) before calling
> getList.
>
> /Chr
>
>
> -----Original Message-----
> From: Frank Budinsky [mailto:frankb@ca.ibm.com]
> Sent: 29. januar 2007 22:48
> To: tuscany-user@ws.apache.org
> Subject: Re: java.lang.ClassCastException
> org.eclipse.emf.ecore.util.EcoreEList$Dynamicincompatible with
> commonj.sdo.DataObject
>
> I'm guessing that the property that your calling getList() for is single
>
> valued. You can only call getList() on a property if the property has
> Property.isMany == true. In other words, there's no automatic conversion
>
> from a single valued property value to List.
>
> Frank.
>
> "Christian Landbo Frederiksen" <Ch...@ementor.dk>
>
> wrote on 01/29/2007 03:24:42 PM:
>
> > Hi
> >
> > I just ran into a classcast exception when I tried to call getList on
> a
> > dataobject.
> >
> > I searched a bit for it and found this in the samples:
> >
> > PurchaseOrderControl.removeItem(int index) {
> >         // TODO: this is not working due to
> > java.lang.ClassCastException:
> >         // org.eclipse.emf.ecore.util.EcoreEList$Dynamic incompatible
> > with commonj.sdo.DataObject
> >         // access a DataObject by the index and then remove it
> >
> >
> > Can anybody tell more about this?
> >
> > /Chr
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
>
>


-- 

Yang ZHONG