[MRM-1437] close stream in CLI

Submitted by: Dave Brosius

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1040930 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2010-12-01 10:15:55 +00:00
parent deba382d42
commit c6e3bb8463
1 changed files with 19 additions and 4 deletions

View File

@ -23,6 +23,7 @@ import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -67,14 +68,28 @@ public class ArchivaCli
public static final String BLACKLISTED_PATTERNS = "blacklistPatterns"; public static final String BLACKLISTED_PATTERNS = "blacklistPatterns";
public static final String POM_PROPERTIES = "/META-INF/maven/org.apache.archiva/archiva-cli/pom.properties";
private static String getVersion() private static String getVersion()
throws IOException throws IOException
{
InputStream pomStream = ArchivaCli.class.getResourceAsStream( POM_PROPERTIES );
if ( pomStream == null )
{
throw new IOException( "Failed to load " + POM_PROPERTIES );
}
try
{ {
Properties properties = new Properties(); Properties properties = new Properties();
properties.load( properties.load( pomStream );
ArchivaCli.class.getResourceAsStream( "/META-INF/maven/org.apache.archiva/archiva-cli/pom.properties" ) );
return properties.getProperty( "version" ); return properties.getProperty( "version" );
} }
finally
{
IOUtils.closeQuietly( pomStream );
}
}
private PlexusClassPathXmlApplicationContext applicationContext; private PlexusClassPathXmlApplicationContext applicationContext;