This is an automated email from the ASF dual-hosted git repository. elharo pushed a commit to branch deps in repository https://gitbox.apache.org/repos/asf/maven-resources-plugin.git
commit c6402799de924d92c0631fe4c09c5eccd26c08bb Author: Elliotte Rusty Harold <elh...@ibiblio.org> AuthorDate: Thu Jul 16 06:29:44 2020 -0400 close file --- .../maven/plugins/resources/stub/MavenProjectBuildStub.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/test/java/org/apache/maven/plugins/resources/stub/MavenProjectBuildStub.java b/src/test/java/org/apache/maven/plugins/resources/stub/MavenProjectBuildStub.java index d6efb1b..eee97a7 100644 --- a/src/test/java/org/apache/maven/plugins/resources/stub/MavenProjectBuildStub.java +++ b/src/test/java/org/apache/maven/plugins/resources/stub/MavenProjectBuildStub.java @@ -291,24 +291,18 @@ public class MavenProjectBuildStub } } - private void populateFile( File file ) + private void populateFile( File file ) throws IOException { - FileOutputStream outputStream; String data = dataMap.get( file.getName() ); if ( ( data != null ) && file.exists() ) { - try + try ( FileOutputStream outputStream = new FileOutputStream( file ) ) { - outputStream = new FileOutputStream( file ); outputStream.write( data.getBytes() ); outputStream.flush(); outputStream.close(); } - catch ( IOException ex ) - { - // TODO: handle exception here - } } } }