JDK-6461817 : UI for the Java Console is initialized several times
  • Type: Bug
  • Component: deploy
  • Sub-Component: deployment_toolkit
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2006-08-19
  • Updated: 2013-11-01
  • Resolved: 2009-03-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 7
7Resolved
Related Reports
Duplicate :  
Relates :  
Description
While debugging an applet, I noticed that the LookAndFeel used by the Java Console is initialized several times when it first appears.  This seems wasteful, and could increase applet startup time on systems where the Java Console is configured to always be shown.
Here are the stack traces: 

java.lang.Exception: Stack trace
	at java.lang.Thread.dumpStack(Thread.java:1158)
	at javax.swing.plaf.basic.BasicLookAndFeel.initialize(BasicLookAndFeel.java:117)
	at javax.swing.UIManager.setLookAndFeel(UIManager.java:440)
	at javax.swing.UIManager.setLookAndFeel(UIManager.java:477)
	at javax.swing.UIManager.initializeDefaultLAF(UIManager.java:1170)
	at javax.swing.UIManager.initialize(UIManager.java:1257)
	at javax.swing.UIManager.maybeInitialize(UIManager.java:1245)
	at javax.swing.UIManager.getLookAndFeel(UIManager.java:407)
	at com.sun.deploy.util.DeployUIManager.setLookAndFeel(Unknown Source)
	at com.sun.deploy.util.ConsoleWindow.create(Unknown Source)
	at sun.plugin.JavaRunTime.getJavaConsole(Unknown Source)
	at sun.plugin.JavaRunTime$1.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
java.lang.Exception: Stack trace
	at java.lang.Thread.dumpStack(Thread.java:1158)
	at javax.swing.plaf.basic.BasicLookAndFeel.uninitialize(BasicLookAndFeel.java:128)
	at javax.swing.UIManager.setLookAndFeel(UIManager.java:434)
	at javax.swing.UIManager.setLookAndFeel(UIManager.java:481)
	at com.sun.deploy.util.DeployUIManager.setLookAndFeel(Unknown Source)
	at com.sun.deploy.util.ConsoleWindow.create(Unknown Source)
	at sun.plugin.JavaRunTime.getJavaConsole(Unknown Source)
	at sun.plugin.JavaRunTime$1.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
java.lang.Exception: Stack trace
	at java.lang.Thread.dumpStack(Thread.java:1158)
	at javax.swing.plaf.basic.BasicLookAndFeel.initialize(BasicLookAndFeel.java:117)
	at com.sun.java.swing.plaf.windows.WindowsLookAndFeel.initialize(WindowsLookAndFeel.java:104)
	at javax.swing.UIManager.setLookAndFeel(UIManager.java:440)
	at javax.swing.UIManager.setLookAndFeel(UIManager.java:481)
	at com.sun.deploy.util.DeployUIManager.setLookAndFeel(Unknown Source)
	at com.sun.deploy.util.ConsoleWindow.create(Unknown Source)
	at sun.plugin.JavaRunTime.getJavaConsole(Unknown Source)
	at sun.plugin.JavaRunTime$1.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
java.lang.Exception: Stack trace
	at java.lang.Thread.dumpStack(Thread.java:1158)
	at javax.swing.plaf.basic.BasicLookAndFeel.uninitialize(BasicLookAndFeel.java:128)
	at com.sun.java.swing.plaf.windows.WindowsLookAndFeel.uninitialize(WindowsLookAndFeel.java:1677)
	at javax.swing.UIManager.setLookAndFeel(UIManager.java:434)
	at com.sun.deploy.util.DeployUIManager.restoreLookAndFeel(Unknown Source)
	at com.sun.deploy.util.ConsoleWindow.create(Unknown Source)
	at sun.plugin.JavaRunTime.getJavaConsole(Unknown Source)
	at sun.plugin.JavaRunTime$1.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
java.lang.Exception: Stack trace
	at java.lang.Thread.dumpStack(Thread.java:1158)
	at javax.swing.plaf.basic.BasicLookAndFeel.initialize(BasicLookAndFeel.java:117)
	at javax.swing.UIManager.setLookAndFeel(UIManager.java:440)
	at com.sun.deploy.util.DeployUIManager.restoreLookAndFeel(Unknown Source)
	at com.sun.deploy.util.ConsoleWindow.create(Unknown Source)
	at sun.plugin.JavaRunTime.getJavaConsole(Unknown Source)
	at sun.plugin.JavaRunTime$1.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

(WRT the line numbers in the stack trace, this was run with the 1.5.0_08 plugin and an instrumented rt.jar from 1.5.0_09.  The problem also happens with 6.0).

Comments
EVALUATION This seems to be resolved as part of 6594219. Before we were trying to get current/default look&feel and this could cause creation of basic LAF. Then if config was set to use system LAF we could have tried to create windows LAF (and this explains second and third stacks - calls to uninitialize basic LAF and initialize windows LAF). Last stack trace is from RestoreLAF and it is not present in DeployUIManager anymore. Therefore i am closing this as duplicate.
03-03-2009

EVALUATION Is this fixed? See evaluation for 5084842.
03-08-2007

EVALUATION At this point, this still doesn't look like a Swing bug. Looking at the stack traces, it looks like the console code is causing the multiple calls: 1) Console calls UIManager.getLookAndFeel() - When no look and feel has been explicitly set, this causes the default L&F to be loaded and installed. 2) Console calls UIManager.setLookAndFeel() at com.sun.deploy.util.DeployUIManager.setLookAndFeel 3) Console calls UIManager.setLookAndFeel() at com.sun.deploy.util.DeployUIManager.restoreLookAndFeel So all of these calls to setLookAndFeel result from something done by the console code.
15-12-2006

EVALUATION i added trace statements to ConsoleWindow.create() (source file is deploy/src/common/share/classes/com/sun/deploy/util/ConsoleWindow.java) and to DeployUIManager.setLookandFeel() (source file is deploy/src/common/share/classes/com/sun/deploy/util/DeployUIManager.java) it seems like these functions are only called once, so i don't think there is any multiple initialization of the LookandFeel from the deploy code.
15-12-2006