-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
19
-
x86_64
-
windows_10
A DESCRIPTION OF THE PROBLEM :
When you try to create a file with specific words in FileOutputStream, the file cannot be created or a FileNotFoundException is thrown.
This is a problem that occurs when you use a file name from "com1" to "com9" regardless of the file extension, and both relative and absolute paths have been checked.
The versions checked so far are as follows.
[JDK]
8 to 17
[OpenJDK]
18-19
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Attempt to create a file with a specific file name using FileOutputStream
2. Complete file creation
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Create file normally
ACTUAL -
File cannot be created or FileNotFoundException occurs
---------- BEGIN SOURCE ----------
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
public class OSTest {
public static void main(String[] args) {
String text = "test";
for (int i = 0; i < 11; i++) {
String filename = "com" + i + ".txt";
File file = new File(filename);
FileOutputStream stream;
try {
stream = new FileOutputStream(file, true);
stream.write(text.getBytes());
stream.close();
File cFile = new File(filename);
if (cFile.exists()) {
System.out.println(filename + " = Success");
} else {
System.out.println(filename + " = Incomplete");
}
} catch (IOException e) {
// e.printStackTrace();
System.out.println(filename + " = Failed");
}
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
nothing
FREQUENCY : always
When you try to create a file with specific words in FileOutputStream, the file cannot be created or a FileNotFoundException is thrown.
This is a problem that occurs when you use a file name from "com1" to "com9" regardless of the file extension, and both relative and absolute paths have been checked.
The versions checked so far are as follows.
[JDK]
8 to 17
[OpenJDK]
18-19
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Attempt to create a file with a specific file name using FileOutputStream
2. Complete file creation
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Create file normally
ACTUAL -
File cannot be created or FileNotFoundException occurs
---------- BEGIN SOURCE ----------
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
public class OSTest {
public static void main(String[] args) {
String text = "test";
for (int i = 0; i < 11; i++) {
String filename = "com" + i + ".txt";
File file = new File(filename);
FileOutputStream stream;
try {
stream = new FileOutputStream(file, true);
stream.write(text.getBytes());
stream.close();
File cFile = new File(filename);
if (cFile.exists()) {
System.out.println(filename + " = Success");
} else {
System.out.println(filename + " = Incomplete");
}
} catch (IOException e) {
// e.printStackTrace();
System.out.println(filename + " = Failed");
}
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
nothing
FREQUENCY : always
- duplicates
-
JDK-4218774 When writting to a FileOutputStream for a file whose name starts with 'com'
- Closed
- links to