Community
Participate
Working Groups
I get an exception when removing a resource and then adding a new with the same path: CDOResource cdoResource = transaction.getOrCreateResource("/model1"); transaction.commit(); cdoResource.getContents().clear(); transaction.getResourceSet().getResources().remove(cdoResource); transaction.commit(); CDOResourceNode resourceNode = transaction.getResourceNode("/model1"); CDOResource resource = transaction.getResource("/model1"); Stack trace: Exception in thread "main" org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.eclipse.emf.cdo.util.InvalidURIException: Invalid URI "cdo://c3ca260d-b348-4a67-b99e-df64f6ef421f/model1": java.lang.IllegalStateException: Duplicate ID: CDOResource@OID4 at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:315) at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274) at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:397) at org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResource(CDOViewImpl.java:632) at org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResource(CDOViewImpl.java:622) at com.comsol.model.util.ModelUtil.create(ModelUtil.java:48) at Main.main(Main.java:25) Caused by: org.eclipse.emf.cdo.util.InvalidURIException: Invalid URI "cdo://c3ca260d-b348-4a67-b99e-df64f6ef421f/model1": java.lang.IllegalStateException: Duplicate ID: CDOResource@OID4 at org.eclipse.emf.internal.cdo.view.CDOViewImpl.registerProxyResource(CDOViewImpl.java:1059) at org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl.load(CDOResourceImpl.java:605) at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:255) at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:270) ... 5 more
Hi Anders, Can you try to write a test case similar to the other ones we have and attach it to this bug? It's really easy, have a look in the o.e.e.cdo.tests plugin and copy one of the Bugzilla_XYZ_Test classes. Bugzillas with test cases are more likely to be fixed very quickly ;-)
Created attachment 146943 [details] Source code for test case I haven't really compiled this and tested it but hopefully it repeats the problem :-)
CDOResourceImpl can be loaded without being in a resourceset and that CDOResourceFactory do not have any context... so it needs to create a new CDOResourceImpl each time a resourceset.createResource() is called... even if we already have it. Could we add a wrapper of CDOResource that delegate to the real one ? I know object identity will be lost... for that object :-( CDOResourceForWrapper - > Will delegate all its call to CDOResource. Maybe it will be a good time to create our own ResourceImpl and delegate the behavior to our CDOResource ? In this case, it will work! We use ResourceImpl only from the resourceset...and we have our real object CDOResource that could be access from our objects.! I will continue to think about something. Simon
Anders, is this bug for the 2.0 release? If so, please tag it as [maintenance]. Thanks :D Víctor.
Hi Victor, I am not sure I understand what you mean... I found the bug with the 2.0 release and you are asking if I want it fixed in the maintenance release?
Hi Anders, that's the answer :D The 2.0 version is now the maintenance branch, as we've entered in the new development cycle for the helios release, which is CDO version 3.0. So yes, I just to clarify that you found it in 2.0, to tag it as "[maintenance]" to have a visual hint to ease identification of 2.0 bugs :) We should also check if this bug affects the 3.0 branch. Cheers, Víctor.
This is really a serious issue. See below for a scenario where you delete a CDO resource from the resource set. Later you look if it is available using "hasResource", which returns 'true' (?) and then when getting the resource "getResource" the exception is thrown. CDOResource cdoResource = transaction.getOrCreateResource("/model1"); transaction.commit(); transaction.getResourceSet().getResources().remove(cdoResource); transaction.commit(); if (transaction.hasResource("/model1")) { // The hasResource will return 'true' ??!! cdoResource = transaction.getResource("/model1"); }
I am taking back my last comment. After discussion with Eike I understand that I have to use resource.delete() to actually delete the resource from the repository. Thus, this bug does not have to be fixed in 2.0 maintenance anymore.
Anders found out that he really wanted to delete the resource permanently from the repository, rather than only locally remove it from the resource set. CDOResource.delete() does the trick. Moving to 3.0 for re-investigation.
Rebasing all outstanding 3.0 problem reports to version 3.0.1
Fixing wrong bug version.
Moving all open problem reports to 4.0
Moving all open bug reports to 4.1 because the release is very near and it's hghly unlikely that there will be spare time to address 4.0 problems. Please make sure that your patches can be applied against the master branch and that your problem is not already fixed there!!!
Moving all open issues to 4.2. Open bugs can be ported to 4.1 maintenance after they've been fixed in master.
We'll try to address open problems in 4.3 (master) first and then port fixes back to 4.2.
Moving all open bugzillas to 4.5.
Moving all unaddressed bugzillas to 4.6.
Moving all open bugs to 4.7
Moving all unresolved issues to version 4.8-
Moving all unresolved issues to version 4.9
Moving to 4.13.