Bug 509301 - OpenJDK 6 failing to load custom look-and-feel classes
Summary: OpenJDK 6 failing to load custom look-and-feel classes
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: java-1.6.0-openjdk
Version: 12
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Omair Majid
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-07-02 04:13 UTC by Kirill Grouchnikov
Modified: 2010-12-05 06:45 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-12-05 06:45:34 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Output of comment 3 (10.07 KB, text/plain)
2009-07-06 16:00 UTC, man lung wong
no flags Details

Description Kirill Grouchnikov 2009-07-02 04:13:32 UTC
https://substance.dev.java.net/webstart/Issue447.jnlp is a very simple JNLP that sets Substance as the look-and-feel and creates an empty frame. It fails with stack traces that look like this:

UIDefaults.getUI() failed: no ComponentUI class for:
javax.swing.JPanel[,0,0,0x0,invalid,layout=java.awt.FlowLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=9,maximumSize=,minimumSize=,preferredSize=]
java.lang.Error
	at javax.swing.UIDefaults.getUIError(UIDefaults.java:728)
	at javax.swing.MultiUIDefaults.getUIError(MultiUIDefaults.java:134)
	at javax.swing.UIDefaults.getUI(UIDefaults.java:758)
	at javax.swing.UIManager.getUI(UIManager.java:1015)
	at javax.swing.JPanel.updateUI(JPanel.java:126)
	at javax.swing.JPanel.<init>(JPanel.java:86)
	at javax.swing.JPanel.<init>(JPanel.java:109)
	at javax.swing.JPanel.<init>(JPanel.java:117)
	at javax.swing.JRootPane.createGlassPane(JRootPane.java:544)
	at javax.swing.JRootPane.<init>(JRootPane.java:364)
	at javax.swing.JFrame.createRootPane(JFrame.java:277)
	at javax.swing.JFrame.frameInit(JFrame.java:258)
	at javax.swing.JFrame.<init>(JFrame.java:225)

The code in the JNLP link below is this:

package test.issues;

import javax.swing.*;

import org.jvnet.substance.SubstanceLookAndFeel;
import org.jvnet.substance.skin.BusinessSkin;

public class Issue447 extends JFrame {
   public Issue447() {
      super("Issue 447");
      this.setSize(300, 200);
      this.setLocationRelativeTo(null);
      this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   }

   public static void main(String[] args) {
      SwingUtilities.invokeLater(new Runnable() {
         @Override
         public void run() {
            SubstanceLookAndFeel.setSkin(new BusinessSkin());

            try {
               UIDefaults defaults = UIManager.getDefaults();
               Object ui = defaults.get("PanelUI");
               System.out.println("PanelUI : " + ui);
               Object cl = defaults.get("ClassLoader");
               System.out.println("ClassLoader : " + cl);
               ClassLoader loader = (cl != null) ? (ClassLoader) cl
                     : JPanel.class.getClassLoader();
               System.out.println("ClassLoader : " + loader);
               String uiClassName = (String) ui;
               System.out.println("UIClassName : " + uiClassName);

               Class cls = (Class) defaults.get(uiClassName);
               System.out.println("Cached class : " + cls);
               if (cls == null) {
                  if (loader == null) {
                     System.out.println("Using system loader to load "
                           + uiClassName);
                     cls = Class.forName(uiClassName, true, Thread
                           .currentThread().getContextClassLoader());
                     System.out.println("Done loading");
                  } else {
                     System.out.println("Using custom loader to load "
                           + uiClassName);
                     cls = loader.loadClass(uiClassName);
                     System.out.println("Done loading");
                  }
                  if (cls != null) {
                     System.out.println("Loaded class : "
                           + cls.getName());
                  } else {
                     System.out.println("Couldn't load the class");
                  }
               }
            } catch (Throwable t) {
               t.printStackTrace(System.out);
            }

            new Issue447().setVisible(true);
         }
      });
   }

}

The code between UIManager.setLookAndFeel and new Issue447().setVisible(true) reproduces the flow in UIManager.getUI() - that goes to UIDefaults.getUI() - except the call to SwingUtilities.loadSystemClass in UIDefaults.getUIClass. Since that method is not public, i've just copied its implementation - Class.forName(uiClassName, true, Thread.currentThread().getContextClassLoader())

Here is the output of the JNLP under Sun JDK:

PanelUI : org.jvnet.substance.SubstancePanelUI
ClassLoader : null
ClassLoader : null
UIClassName : org.jvnet.substance.SubstancePanelUI
Cached class : null
Using system loader to load org.jvnet.substance.SubstancePanelUI
Done loading
Loaded class : org.jvnet.substance.SubstancePanelUI

And here is the output of the JNLP under OpenJDK:

PanelUI : org.jvnet.substance.SubstancePanelUI
ClassLoader : null
ClassLoader : null
UIClassName : org.jvnet.substance.SubstancePanelUI
Cached class : null
Using system loader to load org.jvnet.substance.SubstancePanelUI
java.lang.ClassNotFoundException: org.jvnet.substance.SubstancePanelUI
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at test.issues.Issue447$1.run(Issue447.java:40)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:226)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:602)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)

The org.jvnet.substance.SubstancePanelUI is in the substance.jar which is part of the JNLP (and which is found under JDK 6).

Since this exception is effectively swallowed in UIDefaults.getUIClass, the original exception (at the very top of this post) is quite useless since it has no information on what exactly has happened.

Thanks
Kirill

Comment 1 Kirill Grouchnikov 2009-07-02 04:16:54 UTC
Here is the JNLP file:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="https://substance.dev.java.net/webstart/"
 href="Issue447.jnlp">
<information>
  <title>Substance look and feel demo</title>
  <vendor>https://substance.dev.java.net/</vendor>
  <description>Substance look and feel demo</description> 
  <description kind="short">Substance look and feel demo</description> 
  <offline-allowed/> 
</information>
<offline-allowed/>
<security>
  <all-permissions/>
</security>
<resources>
  <property name="jnlp.packEnabled" value="true"/>
  <j2se version="1.6+" />
  <jar href="substance-tst.jar"/>
  <jar href="substance.jar"/>
</resources>
<application-desc main-class="test.issues.Issue447" />
</jnlp>

As you can see, substance.jar is there in the resources section.

Thanks
Kirill

Comment 2 Kirill Grouchnikov 2009-07-04 00:47:18 UTC
Please see more comments on related issue at [1] - which has more analysis on a very similar scenario that happens on another library under OpenJDK WebStart.

Thanks
Kirill

[1] http://kenai.com/jira/browse/TRIDENT-1?focusedCommentId=15776&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_15776

Comment 3 man lung wong 2009-07-06 15:57:48 UTC
Here is the output I get running the following command off the terminal:

/notnfs/mwong/icedFinal2/openjdk/build/linux-i586/j2sdk-image/bin/javaws https://substance.dev.java.net/webstart/Issue447.jnlp &> output2.txt

and the output is 

UIDefaults.getUI() failed: no ComponentUI class for: javax.swing.JRootPane[,3,21,0x0,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=]
java.lang.Error
	at javax.swing.UIDefaults.getUIError(UIDefaults.java:728)
	at javax.swing.MultiUIDefaults.getUIError(MultiUIDefaults.java:134)
	at javax.swing.UIDefaults.getUI(UIDefaults.java:758)
	at javax.swing.UIManager.getUI(UIManager.java:1015)
	at javax.swing.JRootPane.updateUI(JRootPane.java:482)
	at javax.swing.SwingUtilities.updateComponentTreeUI0
(SwingUtilities.java:1231)
	at javax.swing.SwingUtilities.updateComponentTreeUI0
(SwingUtilities.java:1246)
	at javax.swing.SwingUtilities.updateComponentTreeUI
(SwingUtilities.java:1222)
	at org.jvnet.substance.SubstanceLookAndFeel.setSkin
(SubstanceLookAndFeel.java:1973)
	at org.jvnet.substance.SubstanceLookAndFeel.setSkin
(SubstanceLookAndFeel.java:2053)
	at test.issues.Issue447$1.run(Issue447.java:20)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:226)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:602)
	at java.awt.EventDispatchThread.pumpOneEventForFilters
(EventDispatchThread.java:275)
	at java.awt.EventDispatchThread.pumpEventsForFilter
(EventDispatchThread.java:200)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy
(EventDispatchThread.java:190)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)
UIDefaults.getUI() failed: no ComponentUI class for: javax.swing.JPanel[null.glassPane,0,0,0x0,hidden,layout=java.awt.FlowLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777217,maximumSize=,minimumSize=,preferredSize=]
java.lang.Error
	at javax.swing.UIDefaults.getUIError(UIDefaults.java:728)
	at javax.swing.MultiUIDefaults.getUIError(MultiUIDefaults.java:134)
	at javax.swing.UIDefaults.getUI(UIDefaults.java:758)
	at javax.swing.UIManager.getUI(UIManager.java:1015)
	at javax.swing.JPanel.updateUI(JPanel.java:126)
	at javax.swing.SwingUtilities.updateComponentTreeUI0
(SwingUtilities.java:1231)
	at javax.swing.SwingUtilities.updateComponentTreeUI0
(SwingUtilities.java:1246)
	at javax.swing.SwingUtilities.updateComponentTreeUI0
SwingUtilities.java:1246)
	at javax.swing.SwingUtilities.updateComponentTreeUI
(SwingUtilities.java:1222)
	at org.jvnet.substance.SubstanceLookAndFeel.setSkin
(SubstanceLookAndFeel.java:1973)
	at org.jvnet.substance.SubstanceLookAndFeel.setSkin
(SubstanceLookAndFeel.java:2053)
	at test.issues.Issue447$1.run(Issue447.java:20)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:226)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:602)
	at java.awt.EventDispatchThread.pumpOneEventForFilters
(EventDispatchThread.java:275)
	at java.awt.EventDispatchThread.pumpEventsForFilter
(EventDispatchThread.java:200)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)
UIDefaults.getUI() failed: no ComponentUI class for: javax.swing.JPanel[null.contentPane,0,0,0x0,layout=java.awt.GridBagLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=9,maximumSize=,minimumSize=,preferredSize=]
java.lang.Error
	at javax.swing.UIDefaults.getUIError(UIDefaults.java:728)
	at javax.swing.MultiUIDefaults.getUIError(MultiUIDefaults.java:134)
	at javax.swing.UIDefaults.getUI(UIDefaults.java:758)
	at javax.swing.UIManager.getUI(UIManager.java:1015)
	at javax.swing.JPanel.updateUI(JPanel.java:126)
	at javax.swing.SwingUtilities.updateComponentTreeUI0
(SwingUtilities.java:1231)
	at javax.swing.SwingUtilities.updateComponentTreeUI0
(SwingUtilities.java:1246)
	at javax.swing.SwingUtilities.updateComponentTreeUI0
(SwingUtilities.java:1246)
	at javax.swing.SwingUtilities.updateComponentTreeUI0
(SwingUtilities.java:1246)
	at javax.swing.SwingUtilities.updateComponentTreeUI
(SwingUtilities.java:1222)
	at org.jvnet.substance.SubstanceLookAndFeel.setSkin
(SubstanceLookAndFeel.java:1973)
	at org.jvnet.substance.SubstanceLookAndFeel.setSkin
(SubstanceLookAndFeel.java:2053)
	at test.issues.Issue447$1.run(Issue447.java:20)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:226)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:602)
	at java.awt.EventDispatchThread.pumpOneEventForFilters
(EventDispatchThread.java:275)
	at java.awt.EventDispatchThread.pumpEventsForFilter
(EventDispatchThread.java:200)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy
(EventDispatchThread.java:190)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)
UIDefaults.getUI() failed: no ComponentUI class for: javax.swing.JRootPane[,3,21,500x367,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=javax.swing.plaf.synth.SynthBorder@1486306,flags=16777673,maximumSize=,minimumSize=,preferredSize=]
java.lang.Error
	at javax.swing.UIDefaults.getUIError(UIDefaults.java:728)
	at javax.swing.MultiUIDefaults.getUIError(MultiUIDefaults.java:134)
	at javax.swing.UIDefaults.getUI(UIDefaults.java:758)
	at javax.swing.UIManager.getUI(UIManager.java:1015)
	at javax.swing.JRootPane.updateUI(JRootPane.java:482)
	at javax.swing.SwingUtilities.updateComponentTreeUI0
(SwingUtilities.java:1231)
	at javax.swing.SwingUtilities.updateComponentTreeUI0
(SwingUtilities.java:1246)
	at javax.swing.SwingUtilities.updateComponentTreeUI
(SwingUtilities.java:1222)
	at org.jvnet.substance.SubstanceLookAndFeel.setSkin
(SubstanceLookAndFeel.java:1973)
	at org.jvnet.substance.SubstanceLookAndFeel.setSkin
(SubstanceLookAndFeel.java:2053)
	at test.issues.Issue447$1.run(Issue447.java:20)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:226)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:602)
	at java.awt.EventDispatchThread.pumpOneEventForFilters
(EventDispatchThread.java:275)
	at java.awt.EventDispatchThread.pumpEventsForFilter
(EventDispatchThread.java:200)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy
(EventDispatchThread.java:190)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)
UIDefaults.getUI() failed: no ComponentUI class for: javax.swing.JPanel[null.glassPane,0,0,500x367,hidden,layout=java.awt.FlowLayout,alignmentX=0.0,alignmentY=0.0,border=javax.swing.plaf.synth.SynthBorder@15d4273,flags=16777217,maximumSize=,minimumSize=,preferredSize=]
java.lang.Error
	at javax.swing.UIDefaults.getUIError(UIDefaults.java:728)
	at javax.swing.MultiUIDefaults.getUIError(MultiUIDefaults.java:134)
	at javax.swing.UIDefaults.getUI(UIDefaults.java:758)
	at javax.swing.UIManager.getUI(UIManager.java:1015)
	at javax.swing.JPanel.updateUI(JPanel.java:126)
	at javax.swing.SwingUtilities.updateComponentTreeUI0
(SwingUtilities.java:1231)
	at javax.swing.SwingUtilities.updateComponentTreeUI0
(SwingUtilities.java:1246)
	at javax.swing.SwingUtilities.updateComponentTreeUI0
(SwingUtilities.java:1246)
	at javax.swing.SwingUtilities.updateComponentTreeUI
(SwingUtilities.java:1222)
	at org.jvnet.substance.SubstanceLookAndFeel.setSkin
(SubstanceLookAndFeel.java:1973)
	at org.jvnet.substance.SubstanceLookAndFeel.setSkin
(SubstanceLookAndFeel.java:2053)
	at test.issues.Issue447$1.run(Issue447.java:20)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:226)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:602)
	at java.awt.EventDispatchThread.pumpOneEventForFilters
(EventDispatchThread.java:275)
	at java.awt.EventDispatchThread.pumpEventsForFilter
(EventDispatchThread.java:200)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(
EventDispatchThread.java:190)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)
UIDefaults.getUI() failed: no ComponentUI class for: javax.swing.JPanel[null.contentPane,0,0,500x367,layout=java.awt.BorderLayout,alignmentX=0.0,alignmentY=0.0,border=javax.swing.plaf.synth.SynthBorder@18952cc,flags=9,maximumSize=,minimumSize=,preferredSize=]
java.lang.Error
	at javax.swing.UIDefaults.getUIError(UIDefaults.java:728)
	at javax.swing.MultiUIDefaults.getUIError(MultiUIDefaults.java:134)
	at javax.swing.UIDefaults.getUI(UIDefaults.java:758)
	at javax.swing.UIManager.getUI(UIManager.java:1015)
	at javax.swing.JPanel.updateUI(JPanel.java:126)
	at javax.swing.SwingUtilities.updateComponentTreeUI0
(SwingUtilities.java:1231)
	at javax.swing.SwingUtilities.updateComponentTreeUI0
(SwingUtilities.java:1246)
	at javax.swing.SwingUtilities.updateComponentTreeUI0
(SwingUtilities.java:1246)
	at javax.swing.SwingUtilities.updateComponentTreeUI0
(SwingUtilities.java:1246)
	at javax.swing.SwingUtilities.updateComponentTreeUI
(SwingUtilities.java:1222)
	at org.jvnet.substance.SubstanceLookAndFeel.setSkin
(SubstanceLookAndFeel.java:1973)
	at org.jvnet.substance.SubstanceLookAndFeel.setSkin
(SubstanceLookAndFeel.java:2053)
	at test.issues.Issue447$1.run(Issue447.java:20)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:226)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:602)
	at java.awt.EventDispatchThread.pumpOneEventForFilters
(EventDispatchThread.java:275)
	at java.awt.EventDispatchThread.pumpEventsForFilter
(EventDispatchThread.java:200)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy
(EventDispatchThread.java:190)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)
PanelUI : javax.swing.plaf.synth.SynthLookAndFeel
ClassLoader : null
ClassLoader : null
UIClassName : javax.swing.plaf.synth.SynthLookAndFeel
Cached class : class javax.swing.plaf.synth.SynthLookAndFeel
Disposing window

Can you post the exact steps that you took to produce your output.

Thanks,
Man Lung Wong

Comment 4 man lung wong 2009-07-06 16:00:19 UTC
Created attachment 350629 [details]
Output of comment 3

I realized the copied and pasted output looks pretty messy to read, so here's a plain text file version of it.

Comment 5 Kirill Grouchnikov 2009-07-06 16:14:11 UTC
The output i've attached in my original report goes to stdout and not stderr. The exception that you see is exactly the exception that shouldn't have happened, since the relevant UI delegates are available on the classpath in the substance.jar JNLP entry.

Thanks
Kirill

Comment 6 Omair Majid 2009-07-10 16:24:54 UTC
Hi,

I recently added a patch to Netx [1] that should fix part of the problem. With the patch applied here is the output of javaws:

$ javaws-built Issue447.jnlp 
PanelUI : javax.swing.plaf.synth.SynthLookAndFeel
ClassLoader : null
ClassLoader : null
UIClassName : javax.swing.plaf.synth.SynthLookAndFeel
Cached class : class javax.swing.plaf.synth.SynthLookAndFeel
Disposing window

I dont get any exceptions but the output doesnt look right either... 

This patch does fix the trident issue in https://bugzilla.redhat.com/show_bug.cgi?id=509301#c2

[1] http://icedtea.classpath.org/hg/icedtea6/rev/7acbff01007f

Comment 7 Kirill Grouchnikov 2009-07-11 02:59:39 UTC
I've added a few more printouts to that JNLP to trace why Substance is not set. This is what i see under Sun JDK:

Substance setFlag : true
LookAndFeel class : org.jvnet.substance.SubstanceLookAndFeel$1SkinDerivedLookAndFeel
LookAndFeel name : Substance Business
PanelUI : org.jvnet.substance.SubstancePanelUI
ClassLoader : null
ClassLoader : null
UIClassName : org.jvnet.substance.SubstancePanelUI
Cached class : null
Using system loader to load org.jvnet.substance.SubstancePanelUI
Done loading
Loaded class : org.jvnet.substance.SubstancePanelUI

Can you run this JNLP once again and paste the content of System.out? By the way, do you see any exceptions in System.err?

Thanks
Kirill

Comment 8 Omair Majid 2009-07-16 18:42:44 UTC
(In reply to comment #7)
> Can you run this JNLP once again and paste the content of System.out? By the
> way, do you see any exceptions in System.err?

Here is the output:

$ javaws-built Issue447.jnlp
Substance setFlag : true
LookAndFeel class : com.sun.java.swing.plaf.gtk.GTKLookAndFeel
LookAndFeel name : GTK look and feel
PanelUI : javax.swing.plaf.synth.SynthLookAndFeel
ClassLoader : null
ClassLoader : null
UIClassName : javax.swing.plaf.synth.SynthLookAndFeel
Cached class : class javax.swing.plaf.synth.SynthLookAndFeel

The window that appears seems to be using the Gtk LnF. And I dont see any exceptions. 

Netx displays a few windows before starting the application, and it sets the default LnF to the SystemLookAndFeel. If I remove the UIManager.setLookAndFeel() calls in Netx, then the demo load up with the Substance LookAndFeel but I get lots of exceptions in Netx code related to missing UI component.

Comment 9 Kirill Grouchnikov 2009-07-16 18:53:33 UTC
So there is some code in Netx that overrides the application call to UIManager.setLookAndFeel()? That doesn't seem right to me.

What about the exceptions that you're seeing? Are those the ones with "no ComponentUI class for" in the description? If so, then it is the same issue with using Thread.currentThread().getContextClassLoader() - trace the UIManager.getUI() to the point where it throws the exception.

Thanks
Kirill

Comment 10 Omair Majid 2009-07-16 19:25:15 UTC
(In reply to comment #9)
> So there is some code in Netx that overrides the application call to
> UIManager.setLookAndFeel()? That doesn't seem right to me.

Here's what happens:
 1. Netx calls UIManager.setLookAndFeel(systemLookAndFeel) before displaying any security warning dialogs to the user.
 2. Substance calls UIManager.setLookAndFell(substanceLookAndFeel). For some reason the LookAndFeel doesn't change here and I get no exceptions :(

> What about the exceptions that you're seeing? Are those the ones with "no
> ComponentUI class for" in the description? If so, then it is the same issue
> with using Thread.currentThread().getContextClassLoader() - trace the
> UIManager.getUI() to the point where it throws the exception.

You are probably right, but this time these stack traces involve calls through updateUI methods in Netx. I am going to dig a little more, but this certainly looks like a bug in Netx.

Comment 11 Kirill Grouchnikov 2009-07-16 20:33:33 UTC
I'll update the sample code to do a direct call to UIManager.setLookAndFeel - instead of going through the SubstanceLookAndFeel.setSkin.

Thanks
Kirill

Comment 12 Kirill Grouchnikov 2009-07-23 03:53:22 UTC
The latest version of JNLP has the following source:

package test.issues;

import javax.swing.*;

import org.jvnet.substance.skin.SubstanceBusinessLookAndFeel;

public class Issue447 extends JFrame {
   public Issue447() {
      super("Issue 447");
      this.setSize(300, 200);
      this.setLocationRelativeTo(null);
      this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   }

   public static void main(String[] args) {
      SwingUtilities.invokeLater(new Runnable() {
         @Override
         public void run() {
            try {
               UIManager
                     .setLookAndFeel(new SubstanceBusinessLookAndFeel());
            } catch (Throwable t) {
               t.printStackTrace(System.out);
            }
            System.out.println("LookAndFeel class : "
                  + UIManager.getLookAndFeel().getClass().getName());
            System.out.println("LookAndFeel name : "
                  + UIManager.getLookAndFeel().getName());

            try {
               UIDefaults defaults = UIManager.getDefaults();
               Object ui = defaults.get("PanelUI");
               System.out.println("PanelUI : " + ui);
               Object cl = defaults.get("ClassLoader");
               System.out.println("ClassLoader : " + cl);
               ClassLoader loader = (cl != null) ? (ClassLoader) cl
                     : JPanel.class.getClassLoader();
               System.out.println("ClassLoader : " + loader);
               String uiClassName = (String) ui;
               System.out.println("UIClassName : " + uiClassName);

               Class cls = (Class) defaults.get(uiClassName);
               System.out.println("Cached class : " + cls);
               if (cls == null) {
                  if (loader == null) {
                     System.out.println("Using system loader to load "
                           + uiClassName);
                     cls = Class.forName(uiClassName, true, Thread
                           .currentThread().getContextClassLoader());
                     System.out.println("Done loading");
                  } else {
                     System.out.println("Using custom loader to load "
                           + uiClassName);
                     cls = loader.loadClass(uiClassName);
                     System.out.println("Done loading");
                  }
                  if (cls != null) {
                     System.out.println("Loaded class : "
                           + cls.getName());
                  } else {
                     System.out.println("Couldn't load the class");
                  }
               }
            } catch (Throwable t) {
               t.printStackTrace(System.out);
            }

            new Issue447().setVisible(true);
         }
      });
   }

}


and outputs this under Sun WebStart:

LookAndFeel class : org.jvnet.substance.skin.SubstanceBusinessLookAndFeel
LookAndFeel name : Substance Business
PanelUI : org.jvnet.substance.SubstancePanelUI
ClassLoader : null
ClassLoader : null
UIClassName : org.jvnet.substance.SubstancePanelUI
Cached class : null
Using system loader to load org.jvnet.substance.SubstancePanelUI
Done loading
Loaded class : org.jvnet.substance.SubstancePanelUI

Comment 13 Omair Majid 2009-07-23 14:19:39 UTC
(In reply to comment #12)

> and outputs this under Sun WebStart:
> 
> LookAndFeel class : org.jvnet.substance.skin.SubstanceBusinessLookAndFeel
> LookAndFeel name : Substance Business
> PanelUI : org.jvnet.substance.SubstancePanelUI
> ClassLoader : null
> ClassLoader : null
> UIClassName : org.jvnet.substance.SubstancePanelUI
> Cached class : null
> Using system loader to load org.jvnet.substance.SubstancePanelUI
> Done loading
> Loaded class : org.jvnet.substance.SubstancePanelUI  

Output under my build of Netx:
[omajid@toddler jnlp]$ javaws-built Issue447.jnlp
LookAndFeel class : org.jvnet.substance.skin.SubstanceBusinessLookAndFeel
LookAndFeel name : Substance Business
PanelUI : org.jvnet.substance.SubstancePanelUI
ClassLoader : null
ClassLoader : null
UIClassName : org.jvnet.substance.SubstancePanelUI
Cached class : null
Using system loader to load org.jvnet.substance.SubstancePanelUI
Done loading
Loaded class : org.jvnet.substance.SubstancePanelUI
Disposing window

It works! :) I can see a JFrame using the substance LookAndFeel. Thanks for the fix! 

Btw, the original issue was caused (or rather, pointed out) because the setSkin() method in substance was doing a:
for (Window w: Window.getAllWindows()) { /* update window ui */ } 

Netx (incorrectly) uses installComponents() as a way to build the gui for it's security dialogs. Those dialogs stick around, even after doing a dialog.dispose(). When w is one of those dialogs, updating the ui calls installComponents() which tries to load the new LookAndFeel from the bootstrap classloader, which fails. Replacing the installComponents() kludge with a better implementation also fixes the problem.

Cheers

Comment 14 Kirill Grouchnikov 2009-07-23 15:24:11 UTC
Will this work if i revert the code from UIManager.set(new SubstanceBusinessLookAndFeel) to SubstanceLookAndFeel.setSkin(new BusinessSkin)?

Thanks
Kirill

Comment 15 Omair Majid 2009-07-23 15:37:56 UTC
(In reply to comment #14)
> Will this work if i revert the code from UIManager.set(new
> SubstanceBusinessLookAndFeel) to SubstanceLookAndFeel.setSkin(new
> BusinessSkin)?

Currently, no. I am working on a patch to fix this problem. It might be quite a while before all of this makes it into fedora, of course.

Cheers

Comment 16 Bug Zapper 2009-11-16 10:36:02 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 12 development cycle.
Changing version to '12'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 18 Bug Zapper 2010-11-04 10:52:53 UTC
This message is a reminder that Fedora 12 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 12.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '12'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 12's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 12 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 19 Bug Zapper 2010-12-05 06:45:34 UTC
Fedora 12 changed to end-of-life (EOL) status on 2010-12-02. Fedora 12 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.