Re: getTagValue question

Martin Matula <[email protected]> Mon, 16 Jun 2003 08:28:32 +0200
Newsgroups gmane.comp.java.netbeans.modules.mdr.devel
Message-ID <[email protected]>
Hi Tomas,
This is clearly a bug. Please file a new issue so that you can track 
when it is fixed and try it out. You can also attach a simple XMI file 
generated by MD70 as a test case.
Thanks,
Martin

Tomas Juknevicius wrote:
> Hello dear MDR developers,
> 
> I'm new to this list, so - a very brief introduction on myself.
> I'm the programmer from NoMagic (MagicDraw product).
> Herefrom the interest in this mailing list - modeling tools.
> 
> Now, on to the problem:
> Just recently i've tried the uml2mof tool. Then on the testing phase,
> I discovered one issue. The attributes are not converted correctly,
> if they have org.omg.uml2mof.isOrdered/isDerived/isUnique tags.
> Those tags are ignored. (the bug may have caused additional issues
> in tag handling in other places, not only attributes)
> 
> Looking at the code, i think i found the cause and the fix:
> RCS file:
> /cvs/mdr/extras/uml2mof/src/org/netbeans/lib/jmi/uml2mof/Transformer.java,v
> 
> retrieving revision 1.9
> diff -r1.9 Transformer.java
> 517c517
> <             if (tag.getType() != null && tag.getType().getTagType() !=
> null) {
> ---
> 
>>            if (temp == null && tag.getType() != null) {
> 
> 
> explanation: the getTagValue method incorrectly determines the name of
> the tag:
> at first it gets the correct name:
> String temp = tag.getName(); //(like org.omg.uml2mof.isDerived)
> but then in the next step, it gets overwritten:
> if (tag.getType() != null && tag.getType().getTagType() != null) {
>                 temp = tag.getType().getTagType();
>             }
> 
> it gets overwritten with the type of the tag (like Boolean)
> I think this code here was caused by the bad copy paste somewhere in the
> past,
> and the "if" statement above should be the same as in the nearby
> getTagValues method:
> if (temp == null && tag.getType() != null) {
>           temp = tag.getType().getTagType();
> }
> then  the tag  name is substituted by type name only if there was no tag
> name
> 
> 
> Can anyone with the deeper insight into the code look at this and
> comment on this?
> 
> Note that I use the upcoming MagicDraw7.0 to produce the source xml for
> conversion,
> so this could  cause additional mismatch between tools, but this is
> highly unlikely -
> I've checked the MD70-produced uml/xmi/xml document thoroughly, and
> debugged the converter,
> to see how exactly it resolves those tag names.....
> 
> best regards
> --
> Tomas Juknevicius
> Senior Programmer
> e-mail: Tomas_dot_Juknevicius_at_nomagic_dot_com
> www: www.magicdraw.com, www.nomagic.com
> 
>