aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-cli
diff options
context:
space:
mode:
authorBrett Porter <brett@apache.org>2010-12-01 10:15:55 +0000
committerBrett Porter <brett@apache.org>2010-12-01 10:15:55 +0000
commitc6e3bb846399de4357560aeb905de73688736940 (patch)
tree0cd71c3be305b7169e8a15895414b01e29600daa /archiva-cli
parentdeba382d421307b98402703b050a5864b4e29137 (diff)
downloadarchiva-c6e3bb846399de4357560aeb905de73688736940.tar.gz
archiva-c6e3bb846399de4357560aeb905de73688736940.zip
[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
Diffstat (limited to 'archiva-cli')
-rw-r--r--archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java23
1 files changed, 19 insertions, 4 deletions
diff --git a/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java b/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java
index 0c91aaf2b..cc4d1a156 100644
--- a/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java
+++ b/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java
@@ -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;