JDK-6780457 : Focus problem causing infinite loop
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 6u10
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2008-12-04
  • Updated: 2011-05-19
  • Resolved: 2010-08-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7
6u17Fixed 7 b104Fixed
Description
FULL PRODUCT VERSION :
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33) Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Windows XP

EXTRA RELEVANT SYSTEM CONFIGURATION :
IE 6 and 7

A DESCRIPTION OF THE PROBLEM :
We have some error validation code that results in the display of an error dialog. Previously, the error dialog is displayed when you move focus to another component.

For example, a column has an error. When user clicks away from the column, an error dialog is displayed. When the dialog is dismissed, we shift focus back to the column so that the user can fix the problem. If user clicks away from the column without fixing the error, then the dialog is displayed again.

In update 10, as soon as you dismiss the dialog, another dialog opens immediately. It looks like when the dialog is dismissed, the focusLost() event is fired causing another dialog to appear. This causes an infinite cycle of dialogs being displayed. Once you get into this situation, the only way to get out it is to kill the browser.

The code that displays the error dialog is in a FocusListener. The dialog is displayed when focus is lost.

This problem only occurs in update 10 when I have the "Enable the next-generation Java Plug-in" option checked in the control panel. Unchecking the "next-generation Java Plug-in" will cause the problem to go away.


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
    public class FocusListenerImpl implements FocusListener {
        public void focusGained(FocusEvent arg0) {
        }

        public void focusLost(FocusEvent e) {
            String enteredCode = codeField.getText();
            ModelValidator modelValidator = getCanvas().getBuilder().getModelValidator();
            ModelValidator.ValidationStatus validationStatus = modelValidator.checkColumnCode(getColumn(), enteredCode);

            ModelValidator.showErrorDialog(getCanvas().getBuilder().getTracker(),
                                           validationStatus,
                                           null, getLocale());
            SwingUtilities.invokeLater(new Runnable(){
                public void run(){
                  codeField.requestFocusInWindow();
                  codeField.selectAll();
                }
              });
        }
    }
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Uncheck the "Enable the next-generation Java Plug-in" option in the control panel.

Release Regression From : 6u7
The above release value was the last known release where this 
bug was not reproducible. Since then there has been a regression.
see comments for more info.

Comments
EVALUATION A potential fix is to track when a modal dialog has been dismissed and set a boolean variable. In PluginMain.handleMessageSynthesizeWindowActivation, don't activate the embedded frame and reset the variable if the variable is set.
11-05-2009