RFR(2nd): 8017513: Support for closeable streams

Henry Jen henry.jen at oracle.com
Tue Sep 3 19:02:55 UTC 2013


Updated webrev is at

http://cr.openjdk.java.net/~henryjen/ccc/8017513/2/webrev/

Addressed comments from Alan and catch IOExpression when close on
exception in Files method.

Cheers,
Henry


On 08/29/2013 02:15 AM, Alan Bateman wrote:
> On 29/08/2013 09:51, Paul Sandoz wrote:
>> On Aug 29, 2013, at 8:58 AM, Alan Bateman<Alan.Bateman at oracle.com> 
>> wrote:
>>
>>> :
>>>
>>> I think I mentioned this previously but in the Files.list/walk/etc.
>>> methods where you close the resource (on error|runtimeexception) then
>>> it's probably best to catch the IOException and add it as a
>>> suppressed exception.
>>>
>> Can TWR be used?
>>
>> try (DirectoryStream<Path>  ds = Files.newDirectoryStream(dir) {
>>      ...
>> }
>>
> It should be only closed for the error/exception case (as the Stream
> will keep the directory open).
> 
> Henry - Paul's comment reminds of that "one or more" doesn't need to the
> javadoc for Files.lines as it only opens one directory.
> 
> -Alan.




More information about the core-libs-dev mailing list