[ 
https://issues.apache.org/jira/browse/TUSCANY-3403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12796161#action_12796161
 ] 

Sören Balko commented on TUSCANY-3403:
--------------------------------------

I could narrow down the problem a bit further. It seems to be related to the 
fact that the owner of the "outgoing" list (the "tFlowNode" type from the BPM;N 
2.0 meta model) does have an "xsd:any" and another "xsd:anyAttribute" property 
which are apparently mapped to the property indexes -1 and -2, respectively. 

The "handleMethod" method (in ChangeRecorder from emf-change), tries to fetch 
the "outgoing" list from the "tFlowNode" data object by using the 
(non-internal) property index (=7), instead of the "internal" property index 
(=9, which is declared in the generated class "tFlowNodeImpl"). Seemingly, the 
difference between 7 and 9 is because of the two additional properties having 
negative non-internal property indexes. 

> ClassCastException when adding elements to list-valued property when 
> ChangeSummary is switched on
> -------------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-3403
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-3403
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-1.1
>            Reporter: Sören Balko
>
> Hi!
> I have observed a ClassCastException (see below) that occurs when using 
> change tracking (i.e., the ChangeSummary) feature of a data graph. 
> Specifically, I have a root object "R" in that data graph which contains a 
> list of other data objects ("flowElement"). The nodes, in turn, do have 
> another property "outgoing" holding a list of strings. I have initially (w/o 
> change tracking) created the root object of the DataGraph and added a first 
> data object n1 to the "flowElement" list. Then, I switch on change tracking 
> (using the ChangeSummary instance from the DataGraph) and create another data 
> object n2 which also gets added to the "flowElement" list. Afterwards, both 
> the root object and n2 are returned by ChangeSummary.getChangedDataObject(). 
> When I then try to add a string to the (hitherto empty) n1.outgoing list, I 
> get the exception below.
> Please note that adding the string to n1.outgoing works fine when (1) either 
> change tracking is completely switched off or (2) change tracking is switched 
> on BEFORE n1 is created. What is also worth mentioning is that I am using 
> static data types which are generated from an XSD schema (specifically, the 
> BPMN 2.0 XSD files, see http://www.omg.org/spec/BPMN/2.0/). 
> Thank you very much for having a look into that issue. I am happy to provide 
> further details, if required.
> Cheers,
> Sören
>   
> java.lang.ClassCastException: java.lang.String cannot be cast to 
> java.util.Collection
>       at 
> org.eclipse.emf.ecore.change.util.ChangeRecorder.handleFeature(ChangeRecorder.java:428)
>       at 
> org.eclipse.emf.ecore.change.util.ChangeRecorder.notifyChanged(ChangeRecorder.java:312)
>       at 
> org.apache.tuscany.sdo.impl.ChangeSummaryImpl$SDOChangeRecorder.notifyChanged(ChangeSummaryImpl.java:486)
>       at 
> org.apache.tuscany.sdo.impl.DataObjectImpl.eNotify(DataObjectImpl.java:1374)
>       at 
> org.eclipse.emf.ecore.util.EcoreEList.dispatchNotification(EcoreEList.java:234)
>       at 
> org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:302)
>       at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:600)

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

Reply via email to