diff options
author | Olivier Lamy <olamy@apache.org> | 2014-04-16 23:00:24 +1000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2014-04-16 23:00:24 +1000 |
commit | dc91fae5fada00f27f0210487c70e01bd3865686 (patch) | |
tree | 1a6a6603aa5e049f6b6127176ce8f3f50e4a4cc6 /archiva-modules/archiva-web/archiva-rest/archiva-rest-services | |
parent | 65bcbc9d45b654b66a188c69b55cec2e00037268 (diff) | |
download | archiva-dc91fae5fada00f27f0210487c70e01bd3865686.tar.gz archiva-dc91fae5fada00f27f0210487c70e01bd3865686.zip |
more try with resources
Diffstat (limited to 'archiva-modules/archiva-web/archiva-rest/archiva-rest-services')
-rw-r--r-- | archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java index c929ff106..066105e20 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java @@ -725,12 +725,9 @@ public class DefaultBrowseService List<Artifact> artifactDownloadInfos = new ArrayList<>(); - RepositorySession session = repositorySessionFactory.createSession(); - - MetadataResolver metadataResolver = session.getResolver(); - - try + try (RepositorySession session = repositorySessionFactory.createSession()) { + MetadataResolver metadataResolver = session.getResolver(); for ( String repoId : selectedRepos ) { List<ArtifactMetadata> artifacts = new ArrayList<>( @@ -748,13 +745,6 @@ public class DefaultBrowseService throw new ArchivaRestServiceException( e.getMessage(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e ); } - finally - { - if ( session != null ) - { - session.closeQuietly(); - } - } return artifactDownloadInfos; } |