[jboss-cvs] jboss-seam-tools/src/org/jboss/seam/tools/freemarker ...
Thomas Heute
theute at jboss.com
Mon Jul 24 11:00:22 EDT 2006
User: theute
Date: 06/07/24 11:00:22
Modified: src/org/jboss/seam/tools/freemarker TemplateProcessor.java
Log:
Allow creatiion of basic example project (based on "registration")
Revision Changes Path
1.2 +20 -6 jboss-seam-tools/src/org/jboss/seam/tools/freemarker/TemplateProcessor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: TemplateProcessor.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam-tools/src/org/jboss/seam/tools/freemarker/TemplateProcessor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- TemplateProcessor.java 19 Jul 2006 16:11:34 -0000 1.1
+++ TemplateProcessor.java 24 Jul 2006 15:00:22 -0000 1.2
@@ -14,16 +14,30 @@
public static void process(Configuration cfg, String templateName, Object data, File destination) throws GenerationException
{
+ Template template = null;
try {
- Template template = cfg.getTemplate(templateName);
- FileWriter fileW = new FileWriter(destination);
- template.process(data, fileW);
- fileW.flush();
- fileW.close();
+ template = cfg.getTemplate(templateName);
} catch (IOException e) {
throw new GenerationException("Cannot find: " + templateName);
+ }
+ FileWriter fileW = null;
+ try {
+ fileW = new FileWriter(destination);
+ } catch (IOException e) {
+ throw new GenerationException("Cannot find: " + destination);
+ }
+ try{
+ template.process(data, fileW);
} catch (TemplateException e) {
throw new GenerationException("Cannot process: " + templateName);
+ } catch (IOException e) {
+ throw new GenerationException("IOException");
+ } finally {
+ try {
+ fileW.flush();
+ fileW.close();
+ }
+ catch (IOException e) {}
}
}
More information about the jboss-cvs-commits
mailing list