correct close FileInputStream
git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@1353725 13f79535-47bb-0310-9956-ffa450edef68master
parent
dae672097a
commit
cacac1179b
|
|
@ -105,8 +105,7 @@ public class PluginDescriptorGenerator
|
||||||
// write plugin-help.xml help-descriptor
|
// write plugin-help.xml help-descriptor
|
||||||
MavenProject mavenProject = request.getProject();
|
MavenProject mavenProject = request.getProject();
|
||||||
String pluginHelpFilePath =
|
String pluginHelpFilePath =
|
||||||
"META-INF/maven/" + mavenProject.getGroupId() + "/" + mavenProject.getArtifactId()
|
"META-INF/maven/" + mavenProject.getGroupId() + "/" + mavenProject.getArtifactId() + "/plugin-help.xml";
|
||||||
+ "/plugin-help.xml";
|
|
||||||
f = new File( request.getProject().getBuild().getOutputDirectory(), pluginHelpFilePath );
|
f = new File( request.getProject().getBuild().getOutputDirectory(), pluginHelpFilePath );
|
||||||
writeDescriptor( f, request, true );
|
writeDescriptor( f, request, true );
|
||||||
}
|
}
|
||||||
|
|
@ -153,8 +152,8 @@ public class PluginDescriptorGenerator
|
||||||
|
|
||||||
XMLWriter w = new PrettyPrintXMLWriter( writer, encoding, null );
|
XMLWriter w = new PrettyPrintXMLWriter( writer, encoding, null );
|
||||||
|
|
||||||
w.writeMarkup( "\n<!-- Generated by maven-plugin-tools " + getVersion() + " on "
|
w.writeMarkup( "\n<!-- Generated by maven-plugin-tools " + getVersion() + " on " + new SimpleDateFormat(
|
||||||
+ new SimpleDateFormat( "yyyy-MM-dd" ).format( new Date() ) + " -->\n\n" );
|
"yyyy-MM-dd" ).format( new Date() ) + " -->\n\n" );
|
||||||
|
|
||||||
w.startElement( "plugin" );
|
w.startElement( "plugin" );
|
||||||
|
|
||||||
|
|
@ -174,7 +173,8 @@ public class PluginDescriptorGenerator
|
||||||
{
|
{
|
||||||
GeneratorUtils.element( w, "isolatedRealm", String.valueOf( pluginDescriptor.isIsolatedRealm() ) );
|
GeneratorUtils.element( w, "isolatedRealm", String.valueOf( pluginDescriptor.isIsolatedRealm() ) );
|
||||||
|
|
||||||
GeneratorUtils.element( w, "inheritedByDefault", String.valueOf( pluginDescriptor.isInheritedByDefault() ) );
|
GeneratorUtils.element( w, "inheritedByDefault",
|
||||||
|
String.valueOf( pluginDescriptor.isInheritedByDefault() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
w.startElement( "mojos" );
|
w.startElement( "mojos" );
|
||||||
|
|
@ -260,14 +260,16 @@ public class PluginDescriptorGenerator
|
||||||
|
|
||||||
if ( StringUtils.isNotEmpty( mojoDescriptor.isDependencyResolutionRequired() ) )
|
if ( StringUtils.isNotEmpty( mojoDescriptor.isDependencyResolutionRequired() ) )
|
||||||
{
|
{
|
||||||
GeneratorUtils.element( w, "requiresDependencyResolution", mojoDescriptor.isDependencyResolutionRequired() );
|
GeneratorUtils.element( w, "requiresDependencyResolution",
|
||||||
|
mojoDescriptor.isDependencyResolutionRequired() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
GeneratorUtils.element( w, "requiresDirectInvocation", String.valueOf( mojoDescriptor.isDirectInvocationOnly() ) );
|
GeneratorUtils.element( w, "requiresDirectInvocation",
|
||||||
|
String.valueOf( mojoDescriptor.isDirectInvocationOnly() ) );
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
|
|
@ -538,8 +540,8 @@ public class PluginDescriptorGenerator
|
||||||
|
|
||||||
GeneratorUtils.element( w, "description", parameter.getDescription(), helpDescriptor );
|
GeneratorUtils.element( w, "description", parameter.getDescription(), helpDescriptor );
|
||||||
|
|
||||||
if ( StringUtils.isNotEmpty( parameter.getDefaultValue() )
|
if ( StringUtils.isNotEmpty( parameter.getDefaultValue() ) || StringUtils.isNotEmpty(
|
||||||
|| StringUtils.isNotEmpty( parameter.getExpression() ) )
|
parameter.getExpression() ) )
|
||||||
{
|
{
|
||||||
configuration.add( parameter );
|
configuration.add( parameter );
|
||||||
}
|
}
|
||||||
|
|
@ -663,15 +665,22 @@ public class PluginDescriptorGenerator
|
||||||
rewriteHelpClassFile.getParentFile().mkdirs();
|
rewriteHelpClassFile.getParentFile().mkdirs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FileInputStream fileInputStream = null;
|
||||||
|
|
||||||
ClassReader cr = null;
|
ClassReader cr = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
cr = new ClassReader( new FileInputStream( helpClassFile ) );
|
fileInputStream = new FileInputStream( helpClassFile );
|
||||||
|
cr = new ClassReader( fileInputStream );
|
||||||
}
|
}
|
||||||
catch ( IOException e )
|
catch ( IOException e )
|
||||||
{
|
{
|
||||||
throw new GeneratorException( e.getMessage(), e );
|
throw new GeneratorException( e.getMessage(), e );
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
IOUtil.close( fileInputStream );
|
||||||
|
}
|
||||||
|
|
||||||
ClassWriter cw = new ClassWriter( 0 );
|
ClassWriter cw = new ClassWriter( 0 );
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue