Bug 123182 - Domain Templates with multiple template files only uses first declared template file
Domain Templates with multiple template files only uses first declared templa...
Status: VERIFIED FIXED
Product: uml
Classification: Unclassified
Component: Code Generation
6.x
All All
: P2 (vote)
: 6.x
Assigned To: Viktor Lapitski
issues@uml
release601_fixes_candidate2, release6...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-11-30 19:34 UTC by Craig Conover
Modified: 2008-03-20 18:47 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Craig Conover 2007-11-30 19:34:33 UTC
Reproduction steps:

- Create two template files to be used for code generation. For a really simple example, create a file called foo.txt
with the contents "foo". Another file named bar.txt with the contents "bar".
- Goto Tools->Templates: navigate to UML/Code Generation
- Add the two files: foo.txt and bar.txt
- Goto Tools->Options, UML, Templates tab
- Add a new domain (select Java node and click Add button)
- Set properties for the domain:
  Element type = Class
  Stereotype = twofiles
  Output Parameters:
  Click Add Template: 
    Filename Format = {name}Foo
    Template File = foo.txt
  Click Add Template: 
    Filename Format = {name}Bar
    Template File = bar.txt

- Create a UML project with a Class Diagram
- Add one Class element, name it TestClass
- Add a Stereotype to the class element called twofiles
- Create a Java project
- Generate code for the class element

The result should be two files: TestClassFoo.txt and TestClassBar.txt. The first file should contain the text "foo" and
the second should contain "bar". But they both contain the text "foo".

Obviously, only the first template file is being used. I debugged this and all the code in the UML module appears to be
correct. I suspect the embedded Freemarker template engine is at fault, but not 100% sure.
Comment 1 Craig Conover 2007-11-30 19:46:57 UTC
Forgot one thing...
Don't forget to enable the Domain Template for the UML Project before generating code.
Comment 2 Viktor Lapitski 2008-01-24 07:55:52 UTC
fixed in trunk and unstable_uml_visualcomponent branch
Comment 3 Joanne Lau 2008-02-22 17:51:15 UTC
As the result after generate code, TestClassBar now contains bar, and TestClassFoo contains foo.
Fix verified in 6.1 build 200802191203
Comment 4 khu 2008-02-29 02:01:11 UTC
Please also see a related issue 123186
Comment 5 khu 2008-03-07 19:58:27 UTC
The fix has been ported into the release601_fixes branch

Checking in JavaCodegen.java;
/cvs/uml/codegen/src/org/netbeans/modules/uml/codegen/java/Attic/JavaCodegen.java,v  <--  JavaCodegen.java
new revision: 1.39.6.2; previous revision: 1.39.6.1
done


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo