Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] ClassCastException CDOFeatureDeltaImpl$UnknownValue to InternalEObject
[CDO] ClassCastException CDOFeatureDeltaImpl$UnknownValue to InternalEObject [message #1836527] Wed, 06 January 2021 22:56 Go to next message
Gabe Colburn is currently offline Gabe ColburnFriend
Messages: 28
Registered: December 2012
Junior Member
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() {
	public void notifyChanged(Notification notification) {
                 super.notifyChanged(notification); // Error raised here
                // Notification code here

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$UnknownValue cannot be cast to class org.eclipse.emf.ecore.InternalEObject ($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(
	at org.eclipse.emf.ecore.util.EContentAdapter.handleContainment(
	at org.eclipse.emf.ecore.util.EContentAdapter.selfAdapt(
	at org.eclipse.emf.ecore.util.EContentAdapter.notifyChanged(
	at com.quanteksystems.test.cdo.ListSelection$2.notifyChanged(
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(
	at org.eclipse.emf.common.notify.impl.NotificationChainImpl.dispatch(
	at org.eclipse.emf.common.notify.impl.NotificationChainImpl.dispatch(
	at org.eclipse.emf.internal.cdo.view.CDOViewImpl.sendDeltaNotifications(
	at org.eclipse.emf.internal.cdo.view.CDOViewImpl.doInvalidateSynced(
	at org.eclipse.emf.internal.cdo.view.CDOViewImpl.doInvalidate(
	at org.eclipse.emf.internal.cdo.view.CDOViewImpl$ViewInvalidation.doRun(
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.base/java.util.concurrent.ThreadPoolExecutor$
	at java.base/

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

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 07:08 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6657
Registered: July 2009
Senior Member
I believe this was recently fixed via and released as part of CDO 4.12:

Previous Topic:EMF - genmodel generate test code option not available
Next Topic:How to set a reference with ecore reflection?
Goto Forum:

Current Time: Sun Dec 04 03:21:31 GMT 2022

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

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

Back to the top