About Question enthuware.ocpjp.v8.2.1175 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
lenalena
Posts: 56
Joined: Tue Feb 21, 2017 4:24 pm
Contact:

About Question enthuware.ocpjp.v8.2.1175 :

Post by lenalena »

I'm a bit confused about the symbolic link part of the explanation..
This method copies a file to the target file with the options parameter specifying how the copy is performed. By default, the copy fails if the target file already exists or is a symbolic link, except if the source and target are the same file, in which case the method completes without copying the file. File attributes are not required to be copied to the target file. If symbolic links are supported, and the file is a symbolic link, then the final target of the link is copied. If the file is a directory then it creates an empty directory in the target location (entries in the directory are not copied).
Based on this, if the target is a symbolic link, the copy will fail. What does "If symbolic links are supported, and the file is a symbolic link" mean exactly? Is it talking about the source file here? And is the support of symbolic links default and platform specific or is defined through an option?

The way I understand this explanation, if symbolic links are supported and source and destination are BOTH symbolic links - then copy will fail because the target is a symbolic link. If only the source is the symbolic link, then copy will succeed an the target will be copied.

If NOFOLLOW_LINKS option is set and the source is a symbolic link then the link will be copied and not the target file.

A symbolic link in the target file will always cause the method to fail (regardless of support of symbolic links and NOFOLLOW_LINKS option)

Also, what happens if the source file is a symbolic link and symbolic links are not supported. Exception?

admin
Site Admin
Posts: 10062
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v8.2.1175 :

Post by admin »

lenalena wrote:I'm a bit confused about the symbolic link part of the explanation..
This method copies a file to the target file with the options parameter specifying how the copy is performed. By default, the copy fails if the target file already exists or is a symbolic link, except if the source and target are the same file, in which case the method completes without copying the file. File attributes are not required to be copied to the target file. If symbolic links are supported, and the file is a symbolic link, then the final target of the link is copied. If the file is a directory then it creates an empty directory in the target location (entries in the directory are not copied).
Based on this, if the target is a symbolic link, the copy will fail. What does "If symbolic links are supported, and the file is a symbolic link" mean exactly?
Symbolic links are a feature of the file system. Operations on them depend on that particular file system. So "supported" means implemented by the file system.
Is it talking about the source file here? And is the support of symbolic links default and platform specific or is defined through an option?
Source as well as destination. It talks about both. As mentioned above, it depends on the file system.
The way I understand this explanation, if symbolic links are supported and source and destination are BOTH symbolic links - then copy will fail because the target is a symbolic link. If only the source is the symbolic link, then copy will succeed an the target will be copied.

If NOFOLLOW_LINKS option is set and the source is a symbolic link then the link will be copied and not the target file.

A symbolic link in the target file will always cause the method to fail (regardless of support of symbolic links and NOFOLLOW_LINKS option)
Correct.
Also, what happens if the source file is a symbolic link and symbolic links are not supported. Exception?
Yes, the signature of copy method has IOException in its list of possible exceptions. So you will get that or its subclass in case symbolic links are not supported.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

lenalena
Posts: 56
Joined: Tue Feb 21, 2017 4:24 pm
Contact:

Re: About Question enthuware.ocpjp.v8.2.1175 :

Post by lenalena »

Alright, thank you for clarifying.

thodoris.bais
Posts: 25
Joined: Sat Jun 03, 2017 4:56 pm
Contact:

Re: About Question enthuware.ocpjp.v8.2.1175 :

Post by thodoris.bais »

The respective Javadoc defines ATOMIC_MOVE, instead of NO_FOLLOW_LINKS.
Thus, I think this should also be changed here.

thodoris.bais
Posts: 25
Joined: Sat Jun 03, 2017 4:56 pm
Contact:

Re: About Question enthuware.ocpjp.v8.2.1175 :

Post by thodoris.bais »

@admin ? any news here?
Is what I fore-mentioned right?

admin
Site Admin
Posts: 10062
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v8.2.1175 :

Post by admin »

I am not sure I understand your point. The JavaDoc specifies three values - REPLACE_EXISTING, COPY_ATTRIBUTES, and NOFOLLOW_LINKS.

-Paul.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 107 guests