Community
Participate
Working Groups
Create Resource from CDO transaction, get ResourceSet and remove Resource. This operation fails with following exception: Caused by: org.eclipse.emf.cdo.common.util.CDOException: Attempt to remove a dirty resource from a resource set: CDOResource@oid2 at org.eclipse.emf.internal.cdo.view.CDOViewSetImpl.deregisterResources(CDOViewSetImpl.java:302) at org.eclipse.emf.internal.cdo.view.CDOViewSetImpl.notifyChanged(CDOViewSetImpl.java:259) at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:380) at org.eclipse.emf.common.notify.impl.NotifyingListImpl.dispatchNotification(NotifyingListImpl.java:267) at org.eclipse.emf.common.notify.impl.NotifyingListImpl.remove(NotifyingListImpl.java:719) at org.eclipse.emf.common.util.AbstractEList.remove(AbstractEList.java:466) at org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_360767_Test.testResourceRemoteDetachRemovalNotification(Bugzilla_360767_Test.java:43) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at junit.framework.TestCase.runTest(TestCase.java:168) at org.eclipse.net4j.util.tests.AbstractOMTest.runBare(AbstractOMTest.java:221) at org.eclipse.emf.cdo.tests.config.impl.ConfigTest.runBare(ConfigTest.java:526) ... 33 more
Created attachment 205416 [details] Test case
Are you going to provide a test case?
Argh, ignore my silly question!
This bug has been introduced with the fix to bug 338921. Assigning to Vik for analysis.
I believe that exception is expected. Not exactly sure about the reasons why we introduced it, but its probably related with the fact that if you remove a dirty CDOResource (in this case, a it's in state NEW), the underlying CDOTransaction is left dirty, and that may introduce unwanted changes to future commits. Performing rollback automatically is probably not safe, so I guess this exception is indicating "please tidy up your changes before discarding that resource". Eike, do you recall anything about this? Furthermore, even if that exception didn't raise, yet another would raise, because the resource doesn't exist (the resource is not committed, and neither its part of the ResourceSet, as it has been removed). So the last 3 lines of code of the test-case would fail anyway. What were you exactly trying to achieve?
I remember now and agree with Vik, this is the expected behaviour.