Author: pramirez
Date: Sat Apr 27 23:08:20 2013
New Revision: 1476692
URL: http://svn.apache.org/r1476692
Log:
Don't suppress Exception since interface allows us to throw it. Some minor
comments.
Modified:
oodt/trunk/pge/src/main/java/org/apache/oodt/cas/pge/writers/VelocityConfigFileWriter.java
Modified:
oodt/trunk/pge/src/main/java/org/apache/oodt/cas/pge/writers/VelocityConfigFileWriter.java
URL:
http://svn.apache.org/viewvc/oodt/trunk/pge/src/main/java/org/apache/oodt/cas/pge/writers/VelocityConfigFileWriter.java?rev=1476692&r1=1476691&r2=1476692&view=diff
==============================================================================
---
oodt/trunk/pge/src/main/java/org/apache/oodt/cas/pge/writers/VelocityConfigFileWriter.java
(original)
+++
oodt/trunk/pge/src/main/java/org/apache/oodt/cas/pge/writers/VelocityConfigFileWriter.java
Sat Apr 27 23:08:20 2013
@@ -56,24 +56,23 @@ public class VelocityConfigFileWriter im
Object... args) throws Exception {
File configFile = new File(filePath);
VelocityMetadata velocityMetadata = new VelocityMetadata(metadata);
- try {
- // Velocity requires you to set a path of where to look for
- // templates. This path defaults to . if not set.
- int slashIndex = ((String) args[0]).lastIndexOf('/');
- String templatePath = ((String) args[0]).substring(0, slashIndex);
- Velocity.setProperty("file.resource.loader.path", templatePath);
- Velocity.init();
- VelocityContext context = new VelocityContext();
- context.put("metadata", velocityMetadata);
- context.put("env", System.getenv());
- String templateName = ((String) args[0]).substring(slashIndex);
- Template template = Velocity.getTemplate(templateName);
- StringWriter sw = new StringWriter();
- template.merge(context, sw);
- FileUtils.writeStringToFile(configFile, sw.toString());
- } catch (Exception e) {
- e.printStackTrace();
- }
+ // Velocity requires you to set a path of where to look for
+ // templates. This path defaults to . if not set.
+ int slashIndex = ((String) args[0]).lastIndexOf('/');
+ String templatePath = ((String) args[0]).substring(0, slashIndex);
+ Velocity.setProperty("file.resource.loader.path", templatePath);
+ // Initialize Velocity and set context up
+ Velocity.init();
+ VelocityContext context = new VelocityContext();
+ context.put("metadata", velocityMetadata);
+ context.put("env", System.getenv());
+ // Load template from templatePath
+ String templateName = ((String) args[0]).substring(slashIndex);
+ Template template = Velocity.getTemplate(templateName);
+ // Fill out template and write to file
+ StringWriter sw = new StringWriter();
+ template.merge(context, sw);
+ FileUtils.writeStringToFile(configFile, sw.toString());
return configFile;
}