This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
I have been working with the standalone version of MDR for a little while now and with the help of this mailing list (thanks to all) I managed to overcome most problems encountered so far. But now I'm out of ideas so I'd like to ask here about this problem: Sometimes the default XMIWriter seems to ignore entire classes when serializing a collection of objects into XMI Here's an example metamodel which shows that problem described further below (beware the curse of ASCII-art ;): +-----------------+ +-----------------+ | NewPack1.ClassA |@------| NewPack2.ClassC | +-----------------+ +-----------------+ | ^ @ | | | @ | | +-----------------+ +-----------------+ | NewPack1.ClassB | | NewPack2.ClassD | +-----------------+ +-----------------+ where '@---' means an association, in particular a composition at the end where the '@' is, and '<---' indicates an inheritance relation (between ClassA and ClassB). The prefix in front of the class name shows the package the class is related to. The NewPack1 and NewPack2 prefixes should indicate their package. (Source + XMI as an Eclipse project can be obtained from http://members.yline.com/~tom_at_work/mdrprob.zip , doesn't include mdr-standalone jars) In my main class (MakeExample.java) in the main method run() after the usual stuff (initializing MDR, loading metamodel, ...) I simply create a few instances of classes of my MOF-Model and try to save them: protected void run() throws Exception { // also try createEx1(): gives a null pointer exception // while writing the XML Collection col = createEx2(); // dump contents of model MdrTools.dumpModelPackage(getModelPackage()); // write data XMIWriterFactory.getDefault().createXMIWriter().write(new FileOutputStream("test.xml"), col, "2.0" ); // 2.0 or 1.2 doesn't matter } Here's the method creating instances: private Collection createEx2() { LinkedList result = new LinkedList(); ClassA a_1 = getNewPack1().getClassA().createClassA("aClass1"); ClassA a_2 = getNewPack1().getClassA().createClassA("aClass2"); ClassB b_1 = getNewPack1().getClassB().createClassB("bClass1"); ClassC c_1 = getNewPack2().getClassC().createClassC("cClass1"); ClassC c_2 = getNewPack2().getClassC().createClassC("cClass2"); ClassD d_1 = getNewPack2().getClassD().createClassD(); getNewPack1().getAssoAtoC().add(a_1, c_1); getNewPack1().getAssoAtoC().add(a_1, c_2); getNewPack1().getAssoBtoA().add(b_1, a_1); //! getNewPack2().getAssoDtoC().add(d_1, c_1); result.add(a_1); result.add(a_2); result.add(b_1); result.add(c_1); result.add(c_2); result.add(d_1); return result; } As you can see, it just creates a few instances of metamodel classes, including some associations... The problem are the contents of the generated XMI file: <?xml version = '1.0' encoding = 'ISO-8859-1' ?> <XMI version = '2.0' xmlns = 'http://www.omg.org/XMI'> <NewPack1.ClassA id = 'a1' name = 'aClass2'/> <NewPack1.ClassB id = 'a2' name = 'bClass1'/> <NewPack2.AssoDtoC> <NewPack2.ClassD idref = 'a3'/> <NewPack2.ClassC idref = 'a4'/> </NewPack2.AssoDtoC> <NewPack1.AssoBtoA> <NewPack1.ClassB idref = 'a2'/> <NewPack1.ClassA idref = 'a5'/> </NewPack1.AssoBtoA> <NewPack1.AssoAtoC> <NewPack1.ClassA idref = 'a5'/> <NewPack2.ClassC idref = 'a6'/> <NewPack1.ClassA idref = 'a5'/> <NewPack2.ClassC idref = 'a4'/> </NewPack1.AssoAtoC> </XMI> Parts of the input collection are missing, in particular - ClassA with "aClass1". But if you comment out the line marked with "//!" at least all the objects from NewPack1 are serialized. - all class instances from the NewPack2 package [These two issues seem to be separate]
Created attachment 17430 [details] related model in xmi file
Lowering priority.
I am closing all reports in category Java/Unsupported as wontfix. These should be dead issues --- if the reported cases are against some live part of the NetBeans IDE please reopen and we can discuss to which category they belong.