diff options
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; } |