JDK-8285446 : Java: FileOutputStream("NUL:") not working in 8u331
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 8u331
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows
  • CPU: x86_64
  • Submitted: 2022-04-22
  • Updated: 2022-04-22
  • Resolved: 2022-04-22
Related Reports
Duplicate :  
Duplicate :  
Description
ADDITIONAL SYSTEM INFORMATION :
Windows Server 2019
Oracle Java 8u331 (worked in 8u321)

A DESCRIPTION OF THE PROBLEM :
On Windows, NUL is the null output device similar to /dev/null on Linux.

With Oracle Java 8 Update 331, trying to get a new FileOutputStream("NUL:") throws an exception. Previously (Java 8u321) it worked fine.

The problem seems to be the colon:
* new FileOutputStream("NUL") - OK
* new FileOutputStream("NUL:") - exception


REGRESSION : Last worked in version 8

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
try
{
  new FileOutputStream("NUL:");
  System.out.println("OK");
}
catch (FileNotFoundException e)
{
  System.out.println(e);
}

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
"OK" output
ACTUAL -
java.io.FileNotFoundException: Invalid file path

FREQUENCY : always



Comments
Same issue as JDK-8285445.
22-04-2022

This is a duplicate of JDK-8285445
22-04-2022