From 21f02d4e81438b97d13966fb22f825b2249aa8af Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Tue, 7 Jul 2020 23:57:59 +0200 Subject: [PATCH] Fixing closable stream --- .../apache/archiva/repository/storage/util/StorageUtil.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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( ) ); }