]> source.dussan.org Git - archiva.git/commitdiff
Fixing closable stream
authorMartin Stockhammer <martin_s@apache.org>
Tue, 7 Jul 2020 21:57:59 +0000 (23:57 +0200)
committerMartin Stockhammer <martin_s@apache.org>
Tue, 7 Jul 2020 21:57:59 +0000 (23:57 +0200)
archiva-modules/archiva-base/archiva-storage-api/src/main/java/org/apache/archiva/repository/storage/util/StorageUtil.java

index fa637c66930976cab3b63196a9de869de49e3535..bd52e4b6d3abec80a67badd99a8f62a144619581 100644 (file)
@@ -90,7 +90,8 @@ public class StorageUtil
      */
     public static Stream<StorageAsset> 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( ) );
     }