[9] RFC on 8073061: Files.copy(foo, bar, REPLACE_EXISTING) deletes bar even if foo is not readable

Brian Burkhalter brian.burkhalter at oracle.com
Wed Feb 18 00:56:43 UTC 2015


Please comment at your convenience.

Issue:	https://bugs.openjdk.java.net/browse/JDK-8073061
Patch:	http://cr.openjdk.java.net/~bpb/8073061/webrev.00/

Note that this is for now a RFC as opposed to a RFR. The copyright date of the affected file has not been updated, and there is no new test nor modification of an existing test specific to this change. The change does however pass the test provided in the issue description, and a JPRT job run on the usual suspect platforms with these options -testset core -onlytests '.*jdk_nio.*’ succeeds.

I am not sure that this is the correct approach to take here and would prefer to hear some comment(s) before formalizing an RFR.

The rationale for the change is to avoid deleting the target of the operation (copy(), move()) until the last possible opportunity. This is so that if something fails unexpectedly, the target of the operation will not be deleted in addition to the operation itself failing.

I suppose there might be a much simpler way to address this which I would be happy to hear about.

Thanks,

Brian


More information about the nio-dev mailing list