United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6780457 Focus problem causing infinite loop
JDK-6780457 : Focus problem causing infinite loop

Details
Type:
Bug
Submit Date:
2008-12-04
Status:
Resolved
Updated Date:
2011-05-19
Project Name:
JDK
Resolved Date:
2010-08-03
Component:
deploy
OS:
windows_xp
Sub-Component:
plugin
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
6u10
Fixed Versions:

Related Reports
Backport:
Backport:

Sub Tasks

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.
                                     
2009-05-11



Hardware and Software, Engineered to Work Together