-
Notifications
You must be signed in to change notification settings - Fork 31
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
base: main
Are you sure you want to change the base?
Conversation
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) |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as previous comments.
parents are symlinks
@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 |
Issue: https://issues.redhat.com/browse/GAL-364