Roy Tang

Programmer, engineer, scientist, critic, gamer, dreamer, and kid-at-heart.

Blog Notes Photos Links Archives About

All entries tagged macos.

You can subscribe to an RSS feed of this list.

Dec 2009

  • We have a web screen with a number of applets that has a problem on Mac OSX 10.5.7, Firefox 3.0.15, java 1.5.0_19.

    The problem is encountered on the user site. On initial load of applets (with an empty applet cache), the screen locks up/hangs while loading the applets. After refreshing the page, it loads normally. If the cache is cleared, same problem happens again.

    Unfortunately, we’re not encountering this on our local test machine (same OS, java and Firefox versions)

    We were able to get a jstack thread dump, see below: http://pastebin.com/m527e05dd

    However, we’re not sure how to interpret it. Any suggestions or advice?

    Edit: We were able to replicate in our testing machine by creating a new user (clean Firefox profile). If we clear the java cache then visit the problematic pages, the edit controls are disabled (we can’t click them to focus them), the Firefox address bar and search box have the same behavior. The edit box controls only “unfreeze” when we access the “Help” menu entry, which has a Search edit box that is active.

Nov 2009

  • I have an applet that calls a JDialog that contains a JProgressBar component. I subclass the JDialog to expose a method to update the JProgressBar, something like:

    public class ProgressDialog extends javax.swing.JDialog {
        public void setProgress(double progress) {
            jProgressBar1.setValue(jProgressBar1.getMinimum() + (int) (progress * jProgressBar1.getMaximum()));
        }
        ...
    }
    

    I use this dialog in the following manner:

    public void test() throws Exception {
        progressDialog = new ProgressDialog(null, true);
    
        try {
            progressDialog.setLocationRelativeTo(null);
    
            // show the dialog
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    progressDialog.setVisible(true);
                }
            });
    
            // business logic code that calls progressDialog.setProgress along the way
            doStuff();
            
        } finally {
            progressDialog.setVisible(false);
            progressDialog.dispose();
        }
    }
    

    It works fine on Windows/any browser. However, when invoking the above function on Firefox 2/3/3.5 on a Mac, the progressDialog is displayed indefinitely, i.e. it doesn’t close.

    I suspected that calling setVisible(true) inside the EventQueue was causing the problem, since it’s a blocking call and might block the queue completely, so I tried changing it to:

            // show the dialog
            new Thread() {
                public void run() {
                    progressDialog.setVisible(true);
                }
            }.start();
    

    With this change, the progressDialog now closes correctly, but a new problem emerged - the contents of the dialog (which included the progressbar, an icon and a JLabel used to show a message string) were no longer shown inside the dialog. It was still a problem only on Mac Firefox.

    Any ideas? I realize it’s probably some AWT threading issue, but I’ve been at this for a couple of days and can’t find a good solution. Wrapping the doStuff() business logic in a separate new Thread seems to work, but it’s not easy to refactor the actual business logic code into a separate thread, so I’m hoping there’s a simpler solution.

    The envt is: Mac OSX 10.5 Java 1.5 Firefox 2/3/3.5