--- old/src/share/classes/java/util/stream/LongPipeline.java 2013-07-10 14:11:47.099135558 -0700 +++ new/src/share/classes/java/util/stream/LongPipeline.java 2013-07-10 14:11:46.919135561 -0700 @@ -282,10 +282,11 @@ @Override public void accept(long t) { - // We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it - LongStream result = mapper.apply(t); - if (result != null) - result.sequential().forEach(i -> downstream.accept(i)); + try (LongStream result = mapper.apply(t)) { + // We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it + if (result != null) + result.sequential().forEach(i -> downstream.accept(i)); + } } }; }