--- old/src/share/classes/java/util/stream/IntPipeline.java 2013-07-10 14:11:45.391135588 -0700 +++ new/src/share/classes/java/util/stream/IntPipeline.java 2013-07-10 14:11:45.203135592 -0700 @@ -301,10 +301,11 @@ @Override public void accept(int t) { - // We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it - IntStream result = mapper.apply(t); - if (result != null) - result.sequential().forEach(i -> downstream.accept(i)); + try (IntStream 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)); + } } }; }