close stream

git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@1200898 13f79535-47bb-0310-9956-ffa450edef68
master
Herve Boutemy 2011-11-11 14:26:56 +00:00
parent f9bf892e25
commit 9f2696c98a
1 changed files with 18 additions and 18 deletions

View File

@ -247,35 +247,33 @@ public class PluginHelpGenerator
{ {
MojoDescriptor descriptor = it.next(); MojoDescriptor descriptor = it.next();
String name = "";
int next = 1;
String impl = descriptor.getImplementation(); String impl = descriptor.getImplementation();
if ( impl.lastIndexOf( '.' ) != -1 ) if ( impl.lastIndexOf( '.' ) != -1 )
{ {
String name = impl.substring( 0, impl.lastIndexOf( '.' ) ); name = impl.substring( 0, impl.lastIndexOf( '.' ) );
if ( packageNames.get( name ) != null ) Integer count = packageNames.get( name );
if ( count != null )
{ {
int next = ( (Integer) packageNames.get( name ) ).intValue() + 1; next = count.intValue() + 1;
packageNames.put( name, new Integer( next ) );
}
else
{
packageNames.put( name, new Integer( 1 ) );
} }
} }
else
{ packageNames.put( name, next );
packageNames.put( "", new Integer( 1 ) );
}
} }
String packageName = ""; String packageName = "";
int max = 0; int max = 0;
for ( String key : packageNames.keySet() ) for ( Map.Entry<String, Integer> entry : packageNames.entrySet() )
{ {
int value = ( (Integer) packageNames.get( key ) ).intValue(); int value = entry.getValue().intValue();
if ( value > max ) if ( value > max )
{ {
max = value; max = value;
packageName = key; packageName = entry.getKey();
} }
} }
@ -379,6 +377,10 @@ public class PluginHelpGenerator
{ {
// nope // nope
} }
finally
{
IOUtil.close( resourceAsStream );
}
} }
writer.write( "/**" + LS ); writer.write( "/**" + LS );
@ -512,10 +514,8 @@ public class PluginHelpGenerator
writer.write( LS ); writer.write( LS );
for ( Iterator<MojoDescriptor> it = mojoDescriptors.iterator(); it.hasNext(); ) for ( MojoDescriptor descriptor : mojoDescriptors )
{ {
MojoDescriptor descriptor = it.next();
writeGoal( writer, descriptor ); writeGoal( writer, descriptor );
} }