You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2014/03/17 22:07:49 UTC
svn commit: r1578572 -
/maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/resources/help-class-source.vm
Author: hboutemy
Date: Mon Mar 17 21:07:49 2014
New Revision: 1578572
URL: http://svn.apache.org/r1578572
Log:
[MPLUGIN-255] Generated HelpMojo doesn't close resource stream
Submitted by: Juan Hernandez
applied with formatting fix
Modified:
maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/resources/help-class-source.vm
Modified: maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/resources/help-class-source.vm
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/resources/help-class-source.vm?rev=1578572&r1=1578571&r2=1578572&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/resources/help-class-source.vm (original)
+++ maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/resources/help-class-source.vm Mon Mar 17 21:07:49 2014
@@ -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 );
+ }
+ }
+ }
}
/**