From: Martin Stockhammer Date: Tue, 7 Jul 2020 21:57:59 +0000 (+0200) Subject: Fixing closable stream X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=21f02d4e81438b97d13966fb22f825b2249aa8af;p=archiva.git Fixing closable stream --- diff --git a/archiva-modules/archiva-base/archiva-storage-api/src/main/java/org/apache/archiva/repository/storage/util/StorageUtil.java b/archiva-modules/archiva-base/archiva-storage-api/src/main/java/org/apache/archiva/repository/storage/util/StorageUtil.java index fa637c669..bd52e4b6d 100644 --- a/archiva-modules/archiva-base/archiva-storage-api/src/main/java/org/apache/archiva/repository/storage/util/StorageUtil.java +++ b/archiva-modules/archiva-base/archiva-storage-api/src/main/java/org/apache/archiva/repository/storage/util/StorageUtil.java @@ -90,7 +90,8 @@ public class StorageUtil */ public static Stream newAssetStream( StorageAsset start, boolean parallel ) { - return StreamSupport.stream( new AssetSpliterator( start ), parallel ); + final AssetSpliterator spliterator = new AssetSpliterator( start ); + return StreamSupport.stream( spliterator, parallel ).onClose( ( ) -> spliterator.close( ) ); }