JDK-6389282 : NPE in GTKLookAndFeel.initSystemColorDefaults() on mustang when remote X11 displaying.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,linux,linux_redhat_4.0
  • CPU: generic,x86
  • Submitted: 2006-02-23
  • Updated: 2011-03-09
  • Resolved: 2011-03-07
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 Availabitlity Release.

To download the current JDK release, click here.
JDK 6 JDK 7
6u10Fixed 7 b03Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Description
I was trying the test case from bug 6369498 to see if it was reproducible.
I could not reproduce that problem but I did see the following exception
on mustang b65 and 72 when remote displaying from Linux or Solaris 10 SPARC back
to Solaris 10 SPARC. The test case is in bug 6369498

% /java/re/jdk/1.6.0/promoted/latest/binaries/solaris-sparc/bin/java AppMain
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.initSystemColorDefaults(GTKLookAndFeel.java:1223)
        at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.loadStyles(GTKLookAndFeel.java:1474)
        at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.access$000(GTKLookAndFeel.java:37)
        at com.sun.java.swing.plaf.gtk.GTKLookAndFeel$WeakPCL$1.run(GTKLookAndFeel.java:1414)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)        at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)


It seems possible it is related to 6369498, since just as reported by the submitter
of that bug, it can be avoided by calling 
UIManager.getInstalledLookAndFeels
before calling
 UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");

Comments
EVALUATION UIManager.getLookAndFeelDefaults() returns null when GTKLookAndFeel.loadStyles is called from GTKLookAndFeel.WeakPCL.propertyChange in the situation when we do all the initialization on the main thread but not on the EDT. This causes NPE in initSystemColorDefaults.
2006-09-18

EVALUATION The real cause is that GTKLookAndFeel.initSystemColorDefaults is called asynchroniously. This happens because users don't follow the rule of creation and manipulation all components on the EDT only. They have the old habbit to initialize components on the main thread, call pack() and setVisible() from the main thread and only after that they do everything on the EDT. It's outdated already. This bug has to be fixed hovewer.
2006-09-08

EVALUATION 6339886's changes aren't in the stack trace, and it seems to be more complex The fix for 6339886 was put back into the 2D workspace on 25th Oct but this bug (6389282) did not manifest in the 2D nightly builds until after 2D synced with Master on 12th Nov. That sync got the changes from Swing's 11th Nov b60 putback .. so it seems like it may be an interaction of a couple of fixes. The Swing putback included the fix 6337872: Synth should honor desktop anti aliasing hint so that may have played a part too.
2006-03-13

EVALUATION Looks like this is caused by fix for 6339881: GTK look and feel does not adapt text antialiasing at runtime
2006-03-13