[MPLUGIN-255] Generated HelpMojo doesn't close resource stream
Submitted by: Juan Hernandez applied with formatting fix git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@1578572 13f79535-47bb-0310-9956-ffa450edef68master
parent
abd5f5966a
commit
266d573247
|
|
@ -95,9 +95,10 @@ public class HelpMojo
|
||||||
throws MojoExecutionException
|
throws MojoExecutionException
|
||||||
{
|
{
|
||||||
getLog().debug( "load plugin-help.xml: " + PLUGIN_HELP_PATH );
|
getLog().debug( "load plugin-help.xml: " + PLUGIN_HELP_PATH );
|
||||||
InputStream is = getClass().getResourceAsStream( PLUGIN_HELP_PATH );
|
InputStream is = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
is = getClass().getResourceAsStream( PLUGIN_HELP_PATH );
|
||||||
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
|
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
|
||||||
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
|
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
|
||||||
return dBuilder.parse( is );
|
return dBuilder.parse( is );
|
||||||
|
|
@ -114,6 +115,20 @@ public class HelpMojo
|
||||||
{
|
{
|
||||||
throw new MojoExecutionException( e.getMessage(), e );
|
throw new MojoExecutionException( e.getMessage(), e );
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if ( is != null )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
is.close();
|
||||||
|
}
|
||||||
|
catch ( IOException e )
|
||||||
|
{
|
||||||
|
throw new MojoExecutionException( e.getMessage(), e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue