diff options
author | Olivier Lamy <olamy@apache.org> | 2014-04-17 10:46:06 +1000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2014-04-17 10:46:06 +1000 |
commit | 2132965397ca7d93a66c2eea3dfce98ca377268d (patch) | |
tree | 7062be19f897e4664b78190f864b76b8a29cbd30 /archiva-modules/plugins/maven2-repository/src | |
parent | 0a21a1167f0688c014b0f28b6af9cf5408a687ab (diff) | |
download | archiva-2132965397ca7d93a66c2eea3dfce98ca377268d.tar.gz archiva-2132965397ca7d93a66c2eea3dfce98ca377268d.zip |
more code simplification with 1.7 features
Diffstat (limited to 'archiva-modules/plugins/maven2-repository/src')
-rw-r--r-- | archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java index c7303cef5..0543c334d 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java @@ -87,6 +87,8 @@ import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FilenameFilter; import java.io.IOException; +import java.io.Reader; +import java.nio.charset.Charset; import java.nio.file.Files; import java.util.ArrayList; import java.util.Arrays; @@ -688,19 +690,12 @@ public class Maven2RepositoryStorage try { // MavenXpp3Reader leaves the file open, so we need to close it ourselves. - FileReader reader = new FileReader( pom ); + Model model = null; - try + try (Reader reader = Files.newBufferedReader( pom.toPath(), Charset.defaultCharset() )) { model = MAVEN_XPP_3_READER.read( reader ); } - finally - { - if ( reader != null ) - { - reader.close(); - } - } DistributionManagement dist = model.getDistributionManagement(); if ( dist != null ) @@ -724,10 +719,6 @@ public class Maven2RepositoryStorage } } } - catch ( FileNotFoundException e ) - { - // Artifact has no POM in repo : ignore - } catch ( IOException e ) { // Unable to read POM : ignore. |