Uploaded image for project: 'Tuscany'
  1. Tuscany
  2. TUSCANY-3403

ClassCastException when adding elements to list-valued property when ChangeSummary is switched on

Add voteWatch issue
    XMLWordPrintableJSON

Details

    Description

      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)

      Attachments

        Activity

          People

            Unassigned Unassigned
            sbalko Sören Balko

            Dates

              Created:
              Updated:

              Slack

                Issue deployment