RFR: 8023113: tools/jar/ChangeDir.java fails if /tmp/a exists

Alan Bateman Alan.Bateman at oracle.com
Thu Sep 19 08:52:52 UTC 2013


On 18/09/2013 20:45, Xueming Shen wrote:
> OK, how about this one? I'm even using lambda:-)
>
> http://cr.openjdk.java.net/~sherman/8023113/webrev/
>
> -Sherman
Looks okay except that Files.list returns a stream that needs to be 
closed to avoid leaking resources.

As a side note, as cleanup is attempting to delete a file tree then you 
could eliminate the recursion by using Files.walkFileTree with the 
directories removed in the postVisitDirectory method. It might be 
tempting to use the new walk method but it returns each directory before 
its entries and so isn't appropriate for recursive ops where you need to 
do touch the directory after its entries. I'm not suggesting spending 
any more time on this test of course, you've done more than enough.

-Alan.



More information about the core-libs-dev mailing list