Please use the Apache issue tracking system for new NetBeans issues ( !!

Bug 123182

Summary: Domain Templates with multiple template files only uses first declared template file
Product: uml Reporter: Craig Conover <conover>
Component: Code GenerationAssignee: Viktor Lapitski <lvv>
Status: VERIFIED FIXED QA Contact: issues <>
Priority: P2 CC: sustaining
Version: 6.x   
Target Milestone: 6.x   
Hardware: All   
OS: All   
Whiteboard: release601_fixes_candidate2, release601_fixes_fixed
Issue Type: DEFECT Exception Report:

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;
/cvs/uml/codegen/src/org/netbeans/modules/uml/codegen/java/Attic/,v  <--
new revision:; previous revision:
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