Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GAL-364] Fix installing features pack into a sym-link directory #354

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

spyrkob
Copy link
Contributor

@spyrkob spyrkob commented Aug 28, 2024

@spyrkob spyrkob requested a review from jfdenise as a code owner August 28, 2024 16:14
try {
Files.createDirectories(target);
} catch (FileAlreadyExistsException e) {
// FileAlreadyExistsException happen if the target path already exists and it's not directly (symbolic link or regular file)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't fully follow the content of the comment. The sentence seems incomplete. From the Javadoc, we can read: "if dir exists but is not a directory". if yo ucould clarify in the comment. Thank-you.

// FileAlreadyExistsException happen if the target path already exists and it's not directly (symbolic link or regular file)
// this exception can be ignored if it's symbolic link and if real path of the symbolic link is directory.
if (!Files.isDirectory(target)) {
throw new IOException("Unable to copy file(s) from source path [" + source + "] to target path [" + target + "] because the target path is not directory (regular file or symbolic link where real path is not directory).", e);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't fully follow the content of the Exception. Should it be: " because the target path is not a directory (it is a regular file or a symbolic link where the target path is not a directory)"?

try {
Files.createDirectories(target.getParent());
} catch (FileAlreadyExistsException e) {
// FileAlreadyExistsException happen if the target path already exists and it's not directly (symbolic link or regular file)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as previous comments.

@spyrkob
Copy link
Contributor Author

spyrkob commented Sep 4, 2024

@jfdenise I found one more corner case that previous fix was not covering and changed the logic to evaluate the links in the path before copy operation instead of catching the exception

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants