8204915: (fs) Add some print diagnostics to java/nio/file/Files/CopyAndMove.java

Alan Bateman Alan.Bateman at oracle.com
Thu Jun 14 16:06:07 UTC 2018



On 14/06/2018 16:14, Brian Burkhalter wrote:
> :
>
> It’s already pushed but could be revisited.
>
> When investigating why there were failures when test.dir was set to a 
> different device (https://bugs.openjdk.java.net/browse/JDK-8203803) I 
> found that this information was useful in identifying the root cause 
> of the failures on Linux, macOS, and Windows. Having it in the test 
> log simplifies this analysis.
The main method chooses the directory (or directories if possible) and I 
think that is the place to add the trace messages. I'd like to avoid the 
getFileStore as we've had so many issues with this hanging on specific 
machines (due to stale NFS mounts for example).

> :
>> I think it would be a lot cleaner to just have the main method print 
>> the test directories as it does the setup for all the tests.
>>
>> The other issue is "catch Exception" (x2) to print the various 
>> attributes. These look really ugly. Are these asserts really failing? 
>> I assume you know which assert is failing by the line number but if 
>> additional info is needed then it would be better to just add a 
>> message to the assert.
>
> Yes the line number can be used. The exact nature of the failure is 
> better shown by seeing what the values of the compared items are. The 
> catch does present a problem as it requires examining the print to see 
> exactly which assert failed.  On the other hand, if the first assert 
> fails for example one can see whether the subsequent ones would as well.
>
I hope you see my point that the catching of Exception in these methods 
is a bit ugly. If you really need to print out all the attributes then 
it can be done before the asserts.

-Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20180614/4d80184f/attachment.html>


More information about the nio-dev mailing list