Miłosz S created MCLEAN-93:
------------------------------

             Summary: followSymLinks=false on Windows follows directory 
junctions
                 Key: MCLEAN-93
                 URL: https://issues.apache.org/jira/browse/MCLEAN-93
             Project: Maven Clean Plugin
          Issue Type: Bug
    Affects Versions: 3.1.0, 3.0.0, 2.6.1
            Reporter: Miłosz S


On Windows there are symlinks AND "junctions":

[https://docs.microsoft.com/en-us/windows/win32/fileio/hard-links-and-junctions]

And {{java.nio.file.Files.isSymbolicLink()}} is not detecting junctions, same 
like {{org.apache.maven.shared.utils.io.FileUtils}} from 
{{maven-shared-utils}}. To detect them, you should check for file attributes of 
given {{Path}}:

{code:java}
Path p = Paths.get("C:\\some\\path")
BasicFileAttributes attrs = Files.readAttributes(p, BasicFileAttributes.class, 
LinkOption.NOFOLLOW_LINKS);
boolean isJunction = attrs.isDirectory() && attrs.isOther();
{code}

^Above solution suggested [here on JDK 
JIRA|https://bugs.openjdk.java.net/browse/JDK-8031083?focusedCommentId=13444574&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-13444574]

Related issue: MCLEAN-58





--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to