elharo commented on a change in pull request #44: URL: https://github.com/apache/maven-checkstyle-plugin/pull/44#discussion_r563715320
########## File path: src/main/java/org/apache/maven/plugins/checkstyle/rss/VelocityTemplate.java ########## @@ -77,52 +79,34 @@ public VelocityComponent getVelocity() * Using a specified Velocity Template and provided context, create the outputFilename. * * @param outputFilename the file to be generated. - * @param template the velocity template to use. - * @param context the velocity context map. - * @throws VelocityException if the template was not found or any other Velocity exception. - * @throws MojoExecutionException if merging the velocity template failed. - * @throws IOException if there was an error when writing to the output file. + * @param template the velocity template to use + * @param context the velocity context map + * @throws VelocityException if the template was not found or any other Velocity exception + * @throws MojoExecutionException if merging the velocity template failed + * @throws IOException if there was an error writing to the output file */ public void generate( String outputFilename, String template, Context context ) throws VelocityException, MojoExecutionException, IOException { - Writer writer = null; - try + File f = new File( outputFilename ); + if ( !f.getParentFile().exists() ) + { + f.getParentFile().mkdirs(); + } + + try ( Writer writer = new OutputStreamWriter( new FileOutputStream( f ), StandardCharsets.UTF_8 ) ) { Review comment: done ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org