Skip to main content



      Home
Home » Modeling » EMF » [CDO] ClassCastException CDOFeatureDeltaImpl$UnknownValue to InternalEObject
[CDO] ClassCastException CDOFeatureDeltaImpl$UnknownValue to InternalEObject [message #1836527] Wed, 06 January 2021 17:56 Go to next message
Eclipse UserFriend
When performing a delete of objects in CDO I'm getting a change notification (via an EContentAdapter) in which the oldValue is of type CDOFeatureDeltaImpl$UnknownValue, and fails to cast to InternalEObject when calling super.notifyChanged() on the adapter.

The code is very simple:
adapter = new EContentAdapter() {
	@Override
	public void notifyChanged(Notification notification) {
                 super.notifyChanged(notification); // Error raised here
                // Notification code here
          }
};
object.eAdapters().add(adapter);


See the stack trace beneath. Since the cast is in plain EMF code and not CDO, it seems that a fix is required elsewhere than where the exception is raised. Could you confirm this is a bug and I'm not missing something? I'm not 100% sure that calling super().notifyChanged is necessary, but it seems the examples I've seen all call it.

java.lang.ClassCastException: class org.eclipse.emf.cdo.internal.common.revision.delta.CDOFeatureDeltaImpl$UnknownValue cannot be cast to class org.eclipse.emf.ecore.InternalEObject (org.eclipse.emf.cdo.internal.common.revision.delta.CDOFeatureDeltaImpl$UnknownValue is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @45376166; org.eclipse.emf.ecore.InternalEObject is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @34bd4349)
	at org.eclipse.emf.ecore.util.EContentAdapter.removeAdapter(EContentAdapter.java:420)
	at org.eclipse.emf.ecore.util.EContentAdapter.handleContainment(EContentAdapter.java:185)
	at org.eclipse.emf.ecore.util.EContentAdapter.selfAdapt(EContentAdapter.java:100)
	at org.eclipse.emf.ecore.util.EContentAdapter.notifyChanged(EContentAdapter.java:66)
	at com.quanteksystems.test.cdo.ListSelection$2.notifyChanged(ListSelection.java:172)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:424)
	at org.eclipse.emf.common.notify.impl.NotificationChainImpl.dispatch(NotificationChainImpl.java:200)
	at org.eclipse.emf.common.notify.impl.NotificationChainImpl.dispatch(NotificationChainImpl.java:188)
	at org.eclipse.emf.internal.cdo.view.CDOViewImpl.sendDeltaNotifications(CDOViewImpl.java:1395)
	at org.eclipse.emf.internal.cdo.view.CDOViewImpl.doInvalidateSynced(CDOViewImpl.java:1279)
	at org.eclipse.emf.internal.cdo.view.CDOViewImpl.doInvalidate(CDOViewImpl.java:1216)
	at org.eclipse.emf.internal.cdo.view.CDOViewImpl$ViewInvalidation.doRun(CDOViewImpl.java:2861)
	at org.eclipse.net4j.util.concurrent.RunnableWithName.run(RunnableWithName.java:29)
	at org.eclipse.net4j.util.concurrent.SerializingExecutor.run(SerializingExecutor.java:82)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)


As a temporary workaround I've added a check:
if(notification.getOldValue() instanceof UnknownValue)
	return;


We are currently on the 4.10 release. Thanks!
Re: [CDO] ClassCastException CDOFeatureDeltaImpl$UnknownValue to InternalEObject [message #1836539 is a reply to message #1836527] Thu, 07 January 2021 02:08 Go to previous message
Eclipse UserFriend
I believe this was recently fixed via https://bugs.eclipse.org/bugs/show_bug.cgi?id=568214 and released as part of CDO 4.12: https://download.eclipse.org/modeling/emf/cdo/drops/R20201209-0330/relnotes.html
Previous Topic:EMF - genmodel generate test code option not available
Next Topic:How to set a reference with ecore reflection?
Goto Forum:
  


Current Time: Fri Jul 04 14:26:16 EDT 2025

Powered by FUDForum. Page generated in 0.02598 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top