JDK-8249190 : File-Constructor returns without Slash
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 11
  • Priority: P3
  • Status: Closed
  • Resolution: Not an Issue
  • OS: windows_10
  • CPU: x86_64
  • Submitted: 2020-07-09
  • Updated: 2020-09-11
  • Resolved: 2020-07-15
Related Reports
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
Windows 7 / OpenJDK 11.02

A DESCRIPTION OF THE PROBLEM :
If you do something like this, in earlier Version in return C:\IPC now it Returns C:IPC
File f = new File ("C:", "IPC");
String path =f.getPath();

The Problem occurs in Java.io.WinNtFilesystem in the resolve method on line 239:

        boolean isDirectoryRelative =
            pn == 2 && isLetter(parent.charAt(0)) && parent.charAt(1) == ':';



REGRESSION : Last worked in version 8u192

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
File f = new File ("C:", "IPC");
String path =f.getPath();

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
path = C:\IPC
ACTUAL -
path = C:IPC

FREQUENCY : always
Comments
The "EXPECTED" behavior here is actually incorrect. When the parent consists of a letter followed by a colon, then it is interpreted to represent a drive and the child is interpreted as being relative to the current directory on that drive. See JDK-8153250 for more information.
15-07-2020

The observations on Windows 10: JDK 8: Pass JDK 11: Fail JDK 15: Fail ILW=MMM=P3
10-07-2020