[CDO] DanglingHREFException after putEPackage() [message #615898] |
Mon, 17 March 2008 09:31 |
Stefan Winkler Messages: 307 Registered: July 2009 Location: Germany |
Senior Member |
|
|
Hi Eike,
I'm running into the exception mentioned above. I'm not sure if this is
a bug or if I have to modify my generator model(s).
Here's the setting:
I have two packages and a class in each one - I'll use a textual
notation to illustrate the EMF-Models:
package base {
class BaseClass {
attribute counter : EInt;
operation increment() : void;
}
}
package derived {
class DerivedClass extends base.BaseClass {
operation decrement() : void;
}
}
Package base is defined in base.ecore and base.genmodel. Package derived
is defined likewise in derived.ecore and derived.genmodel, which refers
to base.genmodel. Models validate correctly and model code is generated
as it should.
(This is only an example which I extracted from my code, what I really
want is a package declaring a set of interfaces which classes in other
packages can implement, but the above is the code I used to reproduce
the problem, I can send you the test code if you need it).
Now, what I'm doing is simply creating a container, repository,
transaction, resource etc. and then:
session.getPackageRegistry().putEPackage(BasePackage.eINSTAN CE);
session.getPackageRegistry().putEPackage(DerivedPackage.eINS TANCE);
The first call succeeds, the second one throws an exception:
org.eclipse.net4j.util.io.IORuntimeException: org.eclipse.emf.ecore.resource.Resource$IOWrappedException: The object 'org.eclipse.emf.ecore.impl.EClassImpl@4f15c3 (name: BaseClass) (instanceClassName: null) (abstract: false, interface: false)' is not contained in a resource.
at org.eclipse.emf.cdo.util.EMFUtil.ePackageToString(EMFUtil.ja va:276)
at org.eclipse.emf.internal.cdo.util.ModelUtil.createCDOPackage (ModelUtil.java:162)
at org.eclipse.emf.internal.cdo.util.ModelUtil.getCDOPackage(Mo delUtil.java:128)
at org.eclipse.emf.internal.cdo.CDOPackageRegistryImpl.put(CDOP ackageRegistryImpl.java:85)
at org.eclipse.emf.internal.cdo.CDOPackageRegistryImpl.putEPack age(CDOPackageRegistryImpl.java:64)
at test.CDOPackageRefTests.testPutPackage(CDOPackageRefTests.ja va:97)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.internal.runners.TestMethodRunner.executeMethodBod y(TestMethodRunner.java:99)
at org.junit.internal.runners.TestMethodRunner.runUnprotected(T estMethodRunner.java:81)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestMethodRunner.runMethod(TestMe thodRunner.java:75)
at org.junit.internal.runners.TestMethodRunner.run(TestMethodRu nner.java:45)
at org.junit.internal.runners.TestClassMethodsRunner.invokeTest Method(TestClassMethodsRunner.java:66)
at org.junit.internal.runners.TestClassMethodsRunner.run(TestCl assMethodsRunner.java:35)
at org.junit.internal.runners.TestClassRunner$1.runUnprotected( TestClassRunner.java:42)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestClassRunner.run(TestClassRunn er.java:52)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r un(JUnit4TestReference.java:45)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunne r.main(RemotePluginTestRunner.java:62)
at org.eclipse.pde.internal.junit.runtime.UITestApplication$1.r un(UITestApplication.java:118)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:130)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3737)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3374)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2392)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2356)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 22)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:474)
at org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:288)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:469)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
at org.eclipse.pde.internal.junit.runtime.UITestApplication.sta rt(UITestApplication.java:52)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:193)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:362)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:175)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 564)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1251)
at org.eclipse.equinox.launcher.Main.main(Main.java:1227)
Caused by: org.eclipse.emf.ecore.resource.Resource$IOWrappedException: The object 'org.eclipse.emf.ecore.impl.EClassImpl@4f15c3 (name: BaseClass) (instanceClassName: null) (abstract: false, interface: false)' is not contained in a resource.
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.endSave(XMLSaveIm pl.java:306)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:270)
at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1313)
at org.eclipse.emf.cdo.util.EMFUtil.ePackageToString(EMFUtil.ja va:267)
... 52 more
Caused by: org.eclipse.emf.ecore.xmi.DanglingHREFException: The object 'org.eclipse.emf.ecore.impl.EClassImpl@4f15c3 (name: BaseClass) (instanceClassName: null) (abstract: false, interface: false)' is not contained in a resource.
at org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.handleDanglingH REF(XMLHelperImpl.java:760)
at org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.getURIFragment( XMLHelperImpl.java:731)
at org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.getIDREF(XMLHel perImpl.java:753)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveIDRefMany(XML SaveImpl.java:1983)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1335)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2665)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1154)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1015)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2366)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1513)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2665)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:669)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:586)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:256)
... 55 more
So, is this a bug and CDO has Problems handling referenced packages, or
do I have to modify something in my models or code?
(BTW, I updated to HEAD last Thrusday before testing this...)
Cheers,
Stefan
|
|
|
Powered by
FUDForum. Page generated in 0.02136 seconds