- 
    
Bug
 - 
    Resolution: Unresolved
 - 
    
  P4                     
     - 
    11, 15
 
- 
        x86_64
 - 
        windows
 
                    ADDITIONAL SYSTEM INFORMATION :
Reproducible at least on JDK11 and JDK15.
A DESCRIPTION OF THE PROBLEM :
Path.getFileName() throws StringIndexOutOfBoundsException when the path is a symlink to a network share.
I understand that the problem is in 'WindowsPathParser.parse()', which always appends trailing '\\' to '\\server\share', resulting in 'root' variable being longer than 'path'.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Create a symlink to amn existing network share with:
mklink /d C:\temp\link \\localhost\share
2) Use test snippet
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Path.getFileName() shall return null
ACTUAL -
Path.getFileName() throws StringIndexOutOfBoundsException
---------- BEGIN SOURCE ----------
final Path path = Paths.get("C:/temp/link");
final Path realPath = path.toRealPath();
final Path fileName = realPath.getFileName();
---------- END SOURCE ----------
FREQUENCY : always
            
Reproducible at least on JDK11 and JDK15.
A DESCRIPTION OF THE PROBLEM :
Path.getFileName() throws StringIndexOutOfBoundsException when the path is a symlink to a network share.
I understand that the problem is in 'WindowsPathParser.parse()', which always appends trailing '\\' to '\\server\share', resulting in 'root' variable being longer than 'path'.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Create a symlink to amn existing network share with:
mklink /d C:\temp\link \\localhost\share
2) Use test snippet
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Path.getFileName() shall return null
ACTUAL -
Path.getFileName() throws StringIndexOutOfBoundsException
---------- BEGIN SOURCE ----------
final Path path = Paths.get("C:/temp/link");
final Path realPath = path.toRealPath();
final Path fileName = realPath.getFileName();
---------- END SOURCE ----------
FREQUENCY : always