Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8369061

new File("symlink").list() returns null if link's target is a directory (win)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • tbd
    • 25
    • core-libs
    • None
    • generic
    • windows

      Given a directory with this content

      10/01/2025 04:37 PM <DIR> dir
      10/01/2025 04:41 PM <SYMLINKD> dirlink [dir]
      10/01/2025 04:41 PM <JUNCTION> junction [C:\Users\bpb\dev\bugs\dir]
      10/01/2025 04:41 PM <SYMLINK> symlink [dir]

      the File.list() method returns the contents of "dir" for the paths "dir", "dirlink", and "junction", but returns null for "symlink". The class level specification of File states

      "[...] operations on files that are symbolic links are automatically redirected to the target of the link."

      so either list[Files] needs to be changed to return the same a non-null array with the same contents for"symlink", or it needs to return null for all the above cases with an update to the method specifications to so indicate.

            bpb Brian Burkhalter
            bpb Brian Burkhalter
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: