2323import java .io .File ;
2424import java .io .IOException ;
2525import java .io .StringWriter ;
26+ import java .io .UncheckedIOException ;
2627import java .io .Writer ;
2728import java .nio .charset .Charset ;
2829import java .nio .charset .StandardCharsets ;
@@ -154,9 +155,10 @@ protected void doExecute() throws MojoExecutionException {
154155 }
155156
156157 /**
157- * Do render the template.
158- * @param artifacts input.
159- * @return the template rendered.
158+ * Render the template.
159+ *
160+ * @param artifacts input
161+ * @return the template rendered
160162 */
161163 private String render (final List <Artifact > artifacts ) {
162164 final Path templatePath = getTemplatePath ();
@@ -178,20 +180,18 @@ private String render(final List<Artifact> artifacts) {
178180 context .put ("sorter" , new CollectionTool ());
179181
180182 // Merge template + context
181- final StringWriter writer = new StringWriter ();
182- try (StringWriter ignored = writer ) {
183+ try (StringWriter writer = new StringWriter ()) {
183184 if (fromFile ) {
184185 final Template template =
185186 ve .getTemplate (templatePath .getFileName ().toString ());
186187 template .merge (context , writer );
187188 } else {
188189 ve .evaluate (context , writer , "tpl-" + Math .abs (hashCode ()), template );
189190 }
191+ return writer .toString ();
190192 } catch (final IOException e ) {
191- // no-op, not possible
193+ throw new UncheckedIOException ( " not possible" , e );
192194 }
193-
194- return writer .toString ();
195195 }
196196
197197 private Path getTemplatePath () {
0 commit comments