aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-cli/src/main/java/org/apache/archiva/cli/ArchivaCli.java
diff options
context:
space:
mode:
Diffstat (limited to 'archiva-cli/src/main/java/org/apache/archiva/cli/ArchivaCli.java')
-rw-r--r--archiva-cli/src/main/java/org/apache/archiva/cli/ArchivaCli.java24
1 files changed, 8 insertions, 16 deletions
diff --git a/archiva-cli/src/main/java/org/apache/archiva/cli/ArchivaCli.java b/archiva-cli/src/main/java/org/apache/archiva/cli/ArchivaCli.java
index 031bcac69..a65049597 100644
--- a/archiva-cli/src/main/java/org/apache/archiva/cli/ArchivaCli.java
+++ b/archiva-cli/src/main/java/org/apache/archiva/cli/ArchivaCli.java
@@ -75,22 +75,19 @@ public class ArchivaCli
private static String getVersion()
throws IOException
{
- InputStream pomStream = ArchivaCli.class.getResourceAsStream( POM_PROPERTIES );
- if ( pomStream == null )
- {
- throw new IOException( "Failed to load " + POM_PROPERTIES );
- }
- try
+
+
+ try (InputStream pomStream = ArchivaCli.class.getResourceAsStream( POM_PROPERTIES ))
{
+ if ( pomStream == null )
+ {
+ throw new IOException( "Failed to load " + POM_PROPERTIES );
+ }
Properties properties = new Properties();
properties.load( pomStream );
return properties.getProperty( "version" );
}
- finally
- {
- IOUtils.closeQuietly( pomStream );
- }
}
private ClassPathXmlApplicationContext applicationContext;
@@ -266,16 +263,11 @@ public class ArchivaCli
Properties p = new Properties();
- FileInputStream fis = new FileInputStream( properties );
- try
+ try(FileInputStream fis = new FileInputStream( properties ))
{
p.load( fis );
}
- finally
- {
- IOUtils.closeQuietly( fis );
- }
File oldRepositoryPath = new File( p.getProperty( SOURCE_REPO_PATH ) );