Skip to content

Commit

Permalink
minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ntananh committed Sep 18, 2024
1 parent 2dd4b62 commit 4449ec5
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ public class JinJavaTemplateService implements SQLTemplateService {
@Override
public String renderTemplate(String templateName, Map<String, Object> context) throws IOException {
log.debug("Rendering query from template {}", templateName);
String userTemplateLocation = db2RestConfigProperties.getTemplates();
Path templatePath = Paths.get(userTemplateLocation, templateName + ".sql");
final String userTemplateLocation = db2RestConfigProperties.getTemplates();
final Path templatePath = Paths.get(userTemplateLocation, templateName + ".sql");
if (!Files.exists(templatePath)) {
throw new IllegalArgumentException("Template not found: " + templateName);
}
try {
String templateContent = Files.readString(templatePath);
final String templateContent = Files.readString(templatePath);
return jinjava.render(templateContent, context);
} catch (IOException ioe) {
throw new IOException("Could not read SQL template at: " + templatePath);
Expand Down

0 comments on commit 4449ec5

Please sign in to comment.