-
Bug
-
Resolution: Unresolved
-
P3
-
8, 11, 17, 21
-
None
-
Fix Understood
-
generic
-
generic
ADDITIONAL SYSTEM INFORMATION :
Operating System Details
System Windows 10.
Java SE Version
Version "20.0.1"
A DESCRIPTION OF THE PROBLEM :
Detailed Description of the Problem
1) Type any invalid file/folder name in File Name Text Field provided.
2) Click Approve button.
3) Even though the file does not exists in respective folder, the name entered is accepted and set as selected file.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Steps to Reproduce
Run the application in source code
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expected Result
Error message when invalid file is entered through Text Field (As in other native applications like notepad)
ACTUAL -
Actual Result
Invalid name is accepted and set as selected file.
---------- BEGIN SOURCE ----------
import javax.swing.JFrame;
import javax.swing.JFileChooser;
import java.io.File;
public class TestFileChooser {
public static void main(String[] args) {
JFileChooser fChooser = new JFileChooser();
fChooser.setDialogTitle("Please select folder...");
fChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES );
int returnVal = fChooser.showOpenDialog(new JFrame());
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fChooser.getSelectedFile();
System.out.println("selected: " + file.getAbsolutePath());
}
}
}
---------- END SOURCE ----------
FREQUENCY : always
Operating System Details
System Windows 10.
Java SE Version
Version "20.0.1"
A DESCRIPTION OF THE PROBLEM :
Detailed Description of the Problem
1) Type any invalid file/folder name in File Name Text Field provided.
2) Click Approve button.
3) Even though the file does not exists in respective folder, the name entered is accepted and set as selected file.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Steps to Reproduce
Run the application in source code
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expected Result
Error message when invalid file is entered through Text Field (As in other native applications like notepad)
ACTUAL -
Actual Result
Invalid name is accepted and set as selected file.
---------- BEGIN SOURCE ----------
import javax.swing.JFrame;
import javax.swing.JFileChooser;
import java.io.File;
public class TestFileChooser {
public static void main(String[] args) {
JFileChooser fChooser = new JFileChooser();
fChooser.setDialogTitle("Please select folder...");
fChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES );
int returnVal = fChooser.showOpenDialog(new JFrame());
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fChooser.getSelectedFile();
System.out.println("selected: " + file.getAbsolutePath());
}
}
}
---------- END SOURCE ----------
FREQUENCY : always