-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ArrayIndexOutOfBoundsException in WebFileChooser #121
Comments
This happends in this method: public static File[] getDiskRoots ()
{
final File[] roots = File.listRoots ();
int proper = 0;
for ( final File root : roots )
{
if ( root.isDirectory () )
{
proper++;
}
}
final File[] properRoots = new File[ proper ];
int currentIndex = 0;
for ( final File root : roots )
{
if ( root.isDirectory () )
{
properRoots[ currentIndex ] = root;
currentIndex++;
}
}
return properRoots;
} My guess is that sometimes your file system (well yeh, I have never seens this exception on any of my machines with different OS) returns different value for In any case - I'll just reduce this method usage to one call and it will be fixed. Thanks for pointing out this possible issue :) I will include this fix into v1.28 update. |
#121 - Small fix for FileUtils.getDiskRoots() method WebDocumentPane custom component added (will be completed in v1.28 release) DragManager preview added PopupMenuGenerator preview added Main README updated with more screenshots Screenshots moved into a separate directory
Thanks alot quick response.! |
All changes are available in sources so you can build temporary library version using provided ANT script if you want to test it out right away or you can wait for v1.28 release which will include it. |
Fix is now available in v1.28 update: |
While instantiating WebFileChooser I get the following error. Interestingly, I do not see this error every time. but it does happen 1 in 20 times.
Usage: fileChooser = new WebFileChooser();
Error:
java.lang.ArrayIndexOutOfBoundsException: 3
at com.alee.utils.FileUtils.getDiskRoots(FileUtils.java:375)
at com.alee.extended.filechooser.WebPathField.(WebPathField.java:101)
at com.alee.laf.filechooser.WebFileChooserPanel.createNorthContent(WebFileChooserPanel.java:432)
at com.alee.laf.filechooser.WebFileChooserPanel.(WebFileChooserPanel.java:297)
at com.alee.laf.filechooser.WebFileChooserUI.installUI(WebFileChooserUI.java:108)
at javax.swing.JComponent.setUI(JComponent.java:664)
at com.alee.laf.filechooser.WebFileChooser.updateUI(WebFileChooser.java:308)
at javax.swing.JFileChooser.setup(JFileChooser.java:370)
at javax.swing.JFileChooser.(JFileChooser.java:352)
at javax.swing.JFileChooser.(JFileChooser.java:311)
at com.alee.laf.filechooser.WebFileChooser.(WebFileChooser.java:58)
The text was updated successfully, but these errors were encountered: