MumbleCloseable
Howard Lovatt
howard.lovatt at gmail.com
Sat Jun 29 15:05:18 PDT 2013
+1 that's what I found when experimenting
Sent from my iPad
On 29/06/2013, at 7:58 AM, Remi Forax <forax at univ-mlv.fr> wrote:
> On 06/28/2013 10:20 PM, Brian Goetz wrote:
>> public static Stream<String> lines(Path path, Charset cs) throws IOException {
>> BufferedReader br = Files.newBufferedReader(path, cs);
>> return br.lines().onClose(Closeable.asRunnable(br));
>> }
>
> This code, is leaky, it will not call close() on the buffered reader,
> if lines() or Closeable.asRunnable() throws an unchecked exception.
>
> As I said earlier, the only way to deal with that correctly is to
> open/close the reader only in the terminal method, not before.
>
> Rémi
>
More information about the lambda-libs-spec-observers
mailing list