JDK-6591450 : Plugin always sets the Swing LookAndFeel
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2007-08-10
  • Updated: 2010-07-14
  • Resolved: 2010-07-14
Related Reports
Relates :  
Description
While investigating 6482575 (Leak in ImageIcon), I discovered that the plugin always loads ImageIcon  This makes it more difficult to find and test a fix for 6482575.

sun.plugin.AppletViewer loads ImageIcon explicitly as a workaround for 6482575, but besides that, ImageIcon is also loaded from here:

Exception in thread "Thread-2" java.lang.NoClassDefFoundError: javax/swing/ImageIcon
    at sun.swing.SwingUtilities2$2.createValue(SwingUtilities2.java:1473)
    at javax.swing.UIDefaults.getFromHashtable(UIDefaults.java:217)
    at javax.swing.UIDefaults.get(UIDefaults.java:162)
    at com.sun.java.swing.plaf.windows.WindowsLookAndFeel.initComponentDefaults(WindowsLookAndFeel.java:646)
    at javax.swing.plaf.basic.BasicLookAndFeel.getDefaults(BasicLookAndFeel.java:148)
    at javax.swing.UIManager.setLookAndFeel(UIManager.java:546)
    at javax.swing.UIManager.setLookAndFeel(UIManager.java:590)
->  at com.sun.deploy.util.DeployUIManager.setLookAndFeel(DeployUIManager.java:104)
->  at sun.plugin.util.PluginSysUtil$1.run(PluginSysUtil.java:70)
    at java.lang.Thread.run(Thread.java:644

The trace was from running an AWT-only applet (the DrawTest demo applet) with the console, logging, tracing, and the tray icon all disabled, so I would not expect Swing to be required to be loaded, but it appears that plugin is setting its LookAndFeel anyway.  This loads ~60 classes that shouldn't need to be loaded.

Comments
EVALUATION the swing look and feel should no longer be loaded in awt only applets. Please confirm with 6u12 or later
22-05-2009