Re: UML2MOF transformer bugfix

Martin Matula <[email protected]> Thu, 27 Mar 2003 15:10:29 +0100
Newsgroups gmane.comp.java.netbeans.modules.mdr.devel
Message-ID <[email protected]>
Hi Jozsef,
this fix and a few of others are already there. You probably have an 
out-dated version of sources. But thanks for your effort!
Martin

Jozsef Orosz wrote:
> Hi,
> 
>  Recently I am having problems with uml2mof when I convert XMI files
> exported by Poseidon CE 1.6. The bugs are null pointer exceptions in the
> getMultiplicity() methods in Transformer.java, as Poseidon seems to export
> no multiplicity if it is left at the default 1, and not explicitely set.
> 
>  The problem can be fixed by adding the same line to the Transformer.java at
> lines 560 and 565 (beginning of methods 
> getMultiplicity()). The line you should add is:
> 
> 	if (m==null) return
> mof.createMultiplicityType(1,1,isOrdered,isUnique);
> 
>  which assumes a default multiplicity of 1, if not set.
> 
>  When added these lines to the file, it looks something like:
> 
>     private MultiplicityType getMultiplicity(Multiplicity m, boolean
> isOrdered, boolean isUnique) {
>    	  if (m==null) return
> mof.createMultiplicityType(1,1,isOrdered,isUnique); 	
> 	  ...
>     }
>     
>     private MultiplicityType getMultiplicity(String m, boolean isOrdered,
> boolean isUnique) {
>     	  if (m==null) return
> mof.createMultiplicityType(1,1,isOrdered,isUnique); 
>         StringTokenizer st = new StringTokenizer(m, ".");
>         ...
> 
>  You will need to rebuild uml2mof. The "patched" version of Uml2Mof works
> fine with Poseidon CE 1.6 (No null pointer exceptions).
> 
>  Hope to have helped ya.
> 
>  Greets:
>   Jozsef Orosz