Avatar of csalem01
csalem01
Flag for Afghanistan asked on

java JFileChooser crashes firefox

I have an applet that crashes firefox (by crash I mean completely freezes up and I have to open the task manager and kill the process) most of the time when a dialog from JFileChooser is created.  the applet is signed and it works fine in IE.  Does anyone know of a workaround for this, or another class that I can use?  Here's my java code:

import java.security.AccessController;
import java.security.PrivilegedAction;

import javax.swing.JApplet;
import javax.swing.JFileChooser;


public class TestJFileChooser extends JApplet{

      public void init(){}
      
      public void selectLocalFiles(){
            AccessController.doPrivileged(new PrivilegedAction<Object>(){
                  public Object run() {
                        JFileChooser jfc = new JFileChooser();
                        jfc.setMultiSelectionEnabled(true);

                        int returnval = jfc.showOpenDialog(null);    //this is where it crashes
                        if(returnval == JFileChooser.APPROVE_OPTION){
                              
                        }
                        return null;
                  }                  
            });            
      }
}

and here's the html page:

<html>
<body>

<applet id='imagemgr' name='imagemgr' code='TestJFileChooser.class' archive="TestJFileChooser3.jar" mayscript='mayscript' width=0 height=0></applet>


<a href="javascript: addAttachment()">Test JFileChooser</a>

<script>
function addAttachment(){
      var selectedfile = new Array();
      var startpos = 0;
      document.getElementById("imagemgr").selectLocalFiles();
}
</script>
</body>
</html>
JavaWeb Browsers

Avatar of undefined
Last Comment
csalem01

8/22/2022 - Mon
sciuriware

May be that's the reason that FireFox 3.0.1 is released.

FireFox: Help-> check for updates ......

;JOOP!
csalem01

ASKER
It actually crashes more often with the update.  Seems to crash everytime now.

It only appears to crash if I call the selectLocalFiles() function from javascript.  I added a button to the applet that calls that function and it works fine.
sciuriware

Let Mozilla know about this.

;JOOP!
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
csalem01

ASKER
I reported it to mozilla.  So they'll probably get to it 3 years from now, if ever :(

Can you think of any workaround, or anything besides the JFileChooser that I can use?

Do you think I should report this to Sun as well, I wasn't sure if this would be a bug in firefox or the java plug-in?

Some clients have been complaining about this, so any workaround you can think of would be helpfull
ASKER CERTIFIED SOLUTION
sciuriware

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
csalem01

ASKER
Hopefully java 6u10 fixes the problem, since they're completely changing how applets work.