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

Brian Burkhalter brian.burkhalter at oracle.com
Thu Jun 14 15:14:35 UTC 2018

On Jun 14, 2018, at 1:17 AM, Alan Bateman <Alan.Bateman at oracle.com> wrote:

> On 12/06/2018 23:00, Brian Burkhalter wrote:
>> https://bugs.openjdk.java.net/browse/JDK-8204915
>> http://cr.openjdk.java.net/~bpb/8204915/webrev.00/
>> Please review this simple, test-only change.
> This is a bit ugly and I think needs a bit of discussion to fully understand what you are trying to do.

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.

> There are a number of issues with the patch, the main being that it means getFileStore will be called for each copy/move scenario and we know this can be problematic on some of the test systems due to statle NFS mounts and other issues.

I suppose you mean that the FileStore would be null so we’d end up with an NPE on fs.type().

> 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.

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

More information about the nio-dev mailing list