You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Dan DeRobertis (Jira)" <ji...@apache.org> on 2022/03/07 22:35:00 UTC

[jira] [Created] (GROOVY-10523) Path.traverse() exception if Win10 junction points to non-existing directory

Dan DeRobertis created GROOVY-10523:
---------------------------------------

             Summary: Path.traverse() exception if Win10 junction points to non-existing directory
                 Key: GROOVY-10523
                 URL: https://issues.apache.org/jira/browse/GROOVY-10523
             Project: Groovy
          Issue Type: Bug
    Affects Versions: 4.0.1, 3.0.11
         Environment: Windows 10
            Reporter: Dan DeRobertis


Summary: Win 10 {{Documents }}directory contains a junction {{My Music}} that points to a non-existent directory {{{}C:\Users\dan\Music{}}}.

Observation: _traverse()_ succeeds when using {{{}File{}}}, fails when using {{{}Path{}}}. Issue exists in Groovy 3 + JDK11 and Groovy 4 + JDK17.

 

 
{code:java}
import java.nio.file.Path
import java.nio.file.Paths
import static groovy.io.FileType.DIRECTORIES
static void fileTraverse(String pathStr) {
  File p = new File(pathStr)
  int dirCnt
  p.traverse(
    type: DIRECTORIES,
    visit: {++dirCnt})
  println "file traverse dirCount $dirCnt"
}

static void pathTraverse(String pathStr) {
  Path p = Paths.get(pathStr)
  int dirCnt
  p.traverse(
    type: DIRECTORIES,
    visit: {++dirCnt})
  println "path traverse dirCount $dirCnt"
}
def userDocsDir = 'C:/Users/dan/Documents'
fileTraverse(userDocsDir)  // OK
// Path traverse throws
//   FileNotFoundException: C:\Users\dan\Documents\My Music
// note: "My Music" is a reparse point (junction) pointing to non-existing directory "Music"
// dir /A:DL <JUNCTION> My Music [C:\Users\dan\Music]
pathTraverse(userDocsDir)
 
{code}
 

OS: Windows 10 professional, Xeon processor

{{Groovy 3 + JDK11 environment}}
{{Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.14+8-LTS-263, mixed mode)}}
{{Groovy Version: 3.0.11-SNAPSHOT JVM: 11.0.14 Vendor: Oracle Corporation OS: Windows 10}}

{{Groovy 4 + JDK17 environment}}
{{Java HotSpot(TM) 64-Bit Server VM (build 17.0.2+8-LTS-86, mixed mode, sharing)}}
{{Groovy Version: 4.0.1-SNAPSHOT JVM: 17.0.2 Vendor: Oracle Corporation OS: Windows 10}}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)