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
|
||||
MavenProject mavenProject = request.getProject();
|
||||
String pluginHelpFilePath =
|
||||
"META-INF/maven/" + mavenProject.getGroupId() + "/" + mavenProject.getArtifactId()
|
||||
+ "/plugin-help.xml";
|
||||
"META-INF/maven/" + mavenProject.getGroupId() + "/" + mavenProject.getArtifactId() + "/plugin-help.xml";
|
||||
f = new File( request.getProject().getBuild().getOutputDirectory(), pluginHelpFilePath );
|
||||
writeDescriptor( f, request, true );
|
||||
}
|
||||
|
|
@ -153,8 +152,8 @@ public class PluginDescriptorGenerator
|
|||
|
||||
XMLWriter w = new PrettyPrintXMLWriter( writer, encoding, null );
|
||||
|
||||
w.writeMarkup( "\n<!-- Generated by maven-plugin-tools " + getVersion() + " on "
|
||||
+ new SimpleDateFormat( "yyyy-MM-dd" ).format( new Date() ) + " -->\n\n" );
|
||||
w.writeMarkup( "\n<!-- Generated by maven-plugin-tools " + getVersion() + " on " + new SimpleDateFormat(
|
||||
"yyyy-MM-dd" ).format( new Date() ) + " -->\n\n" );
|
||||
|
||||
w.startElement( "plugin" );
|
||||
|
||||
|
|
@ -174,7 +173,8 @@ public class PluginDescriptorGenerator
|
|||
{
|
||||
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" );
|
||||
|
|
@ -218,8 +218,8 @@ public class PluginDescriptorGenerator
|
|||
}
|
||||
|
||||
/**
|
||||
* @param mojoDescriptor not null
|
||||
* @param w not null
|
||||
* @param mojoDescriptor not null
|
||||
* @param w not null
|
||||
* @param helpDescriptor will clean html content from description fields
|
||||
*/
|
||||
protected void processMojoDescriptor( MojoDescriptor mojoDescriptor, XMLWriter w, boolean helpDescriptor )
|
||||
|
|
@ -260,14 +260,16 @@ public class PluginDescriptorGenerator
|
|||
|
||||
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() ) );
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
//
|
||||
|
|
@ -431,7 +433,7 @@ public class PluginDescriptorGenerator
|
|||
if ( extendedMojoDescriptor.getDependencyCollectionRequired() != null )
|
||||
{
|
||||
GeneratorUtils.element( w, "requiresDependencyCollection",
|
||||
extendedMojoDescriptor.getDependencyCollectionRequired() );
|
||||
extendedMojoDescriptor.getDependencyCollectionRequired() );
|
||||
}
|
||||
|
||||
GeneratorUtils.element( w, "threadSafe", String.valueOf( extendedMojoDescriptor.isThreadSafe() ) );
|
||||
|
|
@ -538,8 +540,8 @@ public class PluginDescriptorGenerator
|
|||
|
||||
GeneratorUtils.element( w, "description", parameter.getDescription(), helpDescriptor );
|
||||
|
||||
if ( StringUtils.isNotEmpty( parameter.getDefaultValue() )
|
||||
|| StringUtils.isNotEmpty( parameter.getExpression() ) )
|
||||
if ( StringUtils.isNotEmpty( parameter.getDefaultValue() ) || StringUtils.isNotEmpty(
|
||||
parameter.getExpression() ) )
|
||||
{
|
||||
configuration.add( parameter );
|
||||
}
|
||||
|
|
@ -627,7 +629,7 @@ public class PluginDescriptorGenerator
|
|||
|
||||
/**
|
||||
* Get the expression value, eventually surrounding it with <code>${ }</code>.
|
||||
*
|
||||
*
|
||||
* @param parameter the parameter
|
||||
* @return the expression value
|
||||
*/
|
||||
|
|
@ -663,15 +665,22 @@ public class PluginDescriptorGenerator
|
|||
rewriteHelpClassFile.getParentFile().mkdirs();
|
||||
}
|
||||
|
||||
FileInputStream fileInputStream = null;
|
||||
|
||||
ClassReader cr = null;
|
||||
try
|
||||
{
|
||||
cr = new ClassReader( new FileInputStream( helpClassFile ) );
|
||||
fileInputStream = new FileInputStream( helpClassFile );
|
||||
cr = new ClassReader( fileInputStream );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new GeneratorException( e.getMessage(), e );
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtil.close( fileInputStream );
|
||||
}
|
||||
|
||||
ClassWriter cw = new ClassWriter( 0 );
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue