You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an application was running on Oracle JRE 8.
I recomplied that application with JDK11 (adomptium)
today I tryed to use that application but I got an error :
JFileChooser fc = new JFileChooser();
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
// THIS PART DOES NOT WORK on JDK 11 - cause a ArrayIndexOutOFBound
fc.setCurrentDirectory(f);
For now, I use the old version in production because JFileChooser are not working.
I cannot reproduce or send you the full; backstrace.
Java version : OpenJDK11U-jre_x64_windows_hotspot_11.0.25_9.zip from Adoptium website
Did you test with the latest update version?
Yes
Please provide steps to reproduce where possible
Here the code...
Create a folder c:\chem32\data\1 and specify srcPath = c:\chem32\data\1
On that folder, we must have at least 1 folder like "1.D" "2.D" "3.D" and inside each folder a file report.txt who contain data from chromatograf
The pourpose of this function is to list all folder on c:\chem32\data\1 and check if there a report.txt file.
If there more that one folder, ask user to select the good folder, othrwise, select the unique folder
private void lastDirectory()
{
System.out.println("lastDirectory() -> GET LAST DIRECTORY");
String Repertoire = "", Testfolder ="";
String []dirlist;
try {
File d = new File(srcPath);
File f = null;
dirlist = d.list();
// count folder
int count = 0;
for(int i = 0; i < dirlist.length; i++)
{
d = new File(srcPath+dirlist[i]);
if(d.isDirectory())
{
Testfolder = srcPath+dirlist[i];
f = new File ( Testfolder + "\\report.txt");
if(f.isFile() == true)
{
System.out.println("lastDirectory() -> Nous avons trouve le fichier");
directory = Testfolder;
reportfilename = Testfolder + "\\report.txt";
System.out.println("lastDirectory() -> Le fichier est : " + reportfilename);
count++;
}
}
}
// WHY WE insciate JFileChooser here ?
JFileChooser fc = new JFileChooser();
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
// THIS PART DOES NOT WORK on JDK 11 - cause a ArrayIndexOutOFBound
fc.setCurrentDirectory(f);
int returnVal = 0;
// Set Repertoire with the last found directory with report.txt
Repertoire = directory;
if(count > 1)
{
System.out.println("lastDirectory() -> more than one directory with report.txt has be found : ");
JOptionPane.showMessageDialog(null,new JLabel("Il y a plus d'un repertoire avec un fichier report.txt, quel repertoire le programme doit traiter ?"),"TGLS6890 - message", JOptionPane.WARNING_MESSAGE);
returnVal = fc.showOpenDialog(null);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File selected_file = fc.getSelectedFile();
Repertoire = selected_file.getAbsolutePath();
}
}
System.out.println("lastDirectory() -> Directory found : " + Repertoire);
System.out.println("lastDirectory() -> Recherche fichier : " + Repertoire + "\\report.txt");
}
Expected Results
program find the correct folder to use.
Actual Results
Application not working
What Java Version are you using?
openjdk 11.0.22 2024-01-16
What is your operating system and platform?
Windows 7 64-bits or Windows 11 64-bits
The version added is the version from my computer (dev station), but on the users computers, that's the version 11.0.25_9
How did you install Java?
From zip file
Did it work before?
Work with a old java 8 version
Did you test with other Java versions?
Relevant log output
The text was updated successfully, but these errors were encountered:
I was able to test on my computer -- JDK 11 ( jdk-11.0.22+7) :
lastDirectory() -> Unknow error in lastDirectory : java.lang.IndexOutOfBoundsException: Invalid index
java.lang.IndexOutOfBoundsException: Invalid index
at java.desktop/javax.swing.DefaultRowSorter.convertUnsortedUnfiltered(DefaultRowSorter.java:523)
at java.desktop/javax.swing.DefaultRowSorter.convertRowIndexToModel(DefaultRowSorter.java:506)
at java.desktop/sun.swing.FilePane$SortableListModel.getElementAt(FilePane.java:751)
at java.desktop/javax.swing.plaf.basic.BasicListUI.updateLayoutState(BasicListUI.java:1438)
at java.desktop/javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(BasicListUI.java:1389)
at java.desktop/javax.swing.plaf.basic.BasicListUI.getCellBounds(BasicListUI.java:1027)
at java.desktop/javax.swing.JList.getCellBounds(JList.java:1641)
at java.desktop/javax.swing.JList.ensureIndexIsVisible(JList.java:1153)
at java.desktop/sun.swing.FilePane.ensureIndexIsVisible(FilePane.java:1805)
at java.desktop/sun.swing.FilePane.doDirectoryChanged(FilePane.java:1728)
at java.desktop/sun.swing.FilePane.propertyChange(FilePane.java:1778)
at java.desktop/java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:341)
at java.desktop/java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:333)
at java.desktop/java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:266)
at java.desktop/java.awt.Component.firePropertyChange(Component.java:8731)
at java.desktop/javax.swing.JFileChooser.setCurrentDirectory(JFileChooser.java:608)
at tgls6890.tgls.lastDirectory(tgls.java:807)
at tgls6890.tgls.integration(tgls.java:382)
at tgls6890.tgls.main(tgls.java:114)
Please provide a brief summary of the bug
I have an application was running on Oracle JRE 8.
I recomplied that application with JDK11 (adomptium)
today I tryed to use that application but I got an error :
JFileChooser fc = new JFileChooser();
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
// THIS PART DOES NOT WORK on JDK 11 - cause a ArrayIndexOutOFBound
fc.setCurrentDirectory(f);
I found someone reported similar bug here : https://bugs.openjdk.org/browse/JDK-8345113
My application are critical and I cannot test like I want.
For now, I use the old version in production because JFileChooser are not working.
I cannot reproduce or send you the full; backstrace.
Java version : OpenJDK11U-jre_x64_windows_hotspot_11.0.25_9.zip from Adoptium website
Did you test with the latest update version?
Please provide steps to reproduce where possible
Here the code...
Create a folder c:\chem32\data\1 and specify srcPath = c:\chem32\data\1
On that folder, we must have at least 1 folder like "1.D" "2.D" "3.D" and inside each folder a file report.txt who contain data from chromatograf
The pourpose of this function is to list all folder on c:\chem32\data\1 and check if there a report.txt file.
If there more that one folder, ask user to select the good folder, othrwise, select the unique folder
private void lastDirectory()
{
System.out.println("lastDirectory() -> GET LAST DIRECTORY");
String Repertoire = "", Testfolder ="";
Expected Results
program find the correct folder to use.
Actual Results
Application not working
What Java Version are you using?
openjdk 11.0.22 2024-01-16
What is your operating system and platform?
Windows 7 64-bits or Windows 11 64-bits
The version added is the version from my computer (dev station), but on the users computers, that's the version 11.0.25_9
How did you install Java?
From zip file
Did it work before?
Did you test with other Java versions?
Relevant log output
The text was updated successfully, but these errors were encountered: