JDK-7149432 : javax.swing.UIManager.setLookAndFeel() throws NPE with Nimbus L&F on UEL/OEL 6.* x64
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 7
  • Priority: P5
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux_oracle_6.0
  • CPU: x86
  • Submitted: 2012-02-28
  • Updated: 2012-02-29
  • Resolved: 2012-02-29
Related Reports
Duplicate :  
Description
JDK/JRE: 7 b147 32 bit
OS/platform: UEL/OEL 6.* x64

The following code throws NPE:

public class Test {
  public static void main(String[] args) throws Exception {
    javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
  }
}

Output:
Exception in thread "main" java.lang.NullPointerException
	at sun.font.FontConfigManager.getFontConfigFont(FontConfigManager.java:352)
	at sun.awt.X11FontManager.getFontConfigFUIR(X11FontManager.java:817)
	at sun.font.FontUtilities.getFontConfigFUIR(FontUtilities.java:484)
	at javax.swing.plaf.nimbus.NimbusDefaults.<init>(NimbusDefaults.java:138)
	at javax.swing.plaf.nimbus.NimbusLookAndFeel.<init>(NimbusLookAndFeel.java:100)
	at com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel.<init>(NimbusLookAndFeel.java:32)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
	at java.lang.Class.newInstance0(Class.java:372)
	at java.lang.Class.newInstance(Class.java:325)
	at javax.swing.UIManager.setLookAndFeel(UIManager.java:576)
	at Test.main(Test.java:3)

It is the reason of failure of the following JCK test:

api/signaturetest/sigtest.basic.html#basic

Comments
EVALUATION > There were not 32-bit libfontconfig library on machine. It may be the reason of failure. Yes, is the cause, but we shouldn't fail. We don't hard link against libfontconfig and we shouldn't NPE if we can avoid it This was previously reported as 7068471: NPE in sun.font.FontConfigManager.getFontConfigFont() when libfontconfig.so is not installed Thus this is a duplicate of that bug which is fixed in JDK 8 b01. The workaround is to install the lib, but beware, the submitter is correct that "according to JDK 7 PRD, only 64 bit JVM is supported on UEL/OEL 6.* x64." and he may find more things that don't work. This is precisely because 64 bit Linux distros "out of the box" fail to install many libraries needed for 32 bit clients and its not possible for us to provide the recipe to fix this for all the Linux distros that might now or in the future do so.
29-02-2012