diff --git a/maven-plugin-tools-generators/src/main/resources/help-class-source.vm b/maven-plugin-tools-generators/src/main/resources/help-class-source.vm index f86a5f4..03d034c 100644 --- a/maven-plugin-tools-generators/src/main/resources/help-class-source.vm +++ b/maven-plugin-tools-generators/src/main/resources/help-class-source.vm @@ -95,9 +95,10 @@ public class HelpMojo throws MojoExecutionException { getLog().debug( "load plugin-help.xml: " + PLUGIN_HELP_PATH ); - InputStream is = getClass().getResourceAsStream( PLUGIN_HELP_PATH ); + InputStream is = null; try { + is = getClass().getResourceAsStream( PLUGIN_HELP_PATH ); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); return dBuilder.parse( is ); @@ -114,6 +115,20 @@ public class HelpMojo { throw new MojoExecutionException( e.getMessage(), e ); } + finally + { + if ( is != null ) + { + try + { + is.close(); + } + catch ( IOException e ) + { + throw new MojoExecutionException( e.getMessage(), e ); + } + } + } } /**