[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.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Arrays;
@ -66,14 +67,28 @@ public class ArchivaCli
public static final String TARGET_REPO_PATH = "targetRepositoryPath";
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()
throws IOException
{
Properties properties = new Properties();
properties.load(
ArchivaCli.class.getResourceAsStream( "/META-INF/maven/org.apache.archiva/archiva-cli/pom.properties" ) );
return properties.getProperty( "version" );
InputStream pomStream = ArchivaCli.class.getResourceAsStream( POM_PROPERTIES );
if ( pomStream == null )
{
throw new IOException( "Failed to load " + POM_PROPERTIES );
}
try
{
Properties properties = new Properties();
properties.load( pomStream );
return properties.getProperty( "version" );
}
finally
{
IOUtils.closeQuietly( pomStream );
}
}
private PlexusClassPathXmlApplicationContext applicationContext;