United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 6389282 NPE in GTKLookAndFeel.initSystemColorDefaults() on mustang when remote X11 displaying.
6389282 : NPE in GTKLookAndFeel.initSystemColorDefaults() on mustang when remote X11 displaying.

Details
Type:
Bug
Submit Date:
2006-02-23
Status:
Closed
Updated Date:
2011-03-09
Project Name:
JDK
Resolved Date:
2011-03-07
Component:
client-libs
OS:
linux_redhat_4.0,linux,generic
Sub-Component:
javax.swing
CPU:
x86,generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:
7

Related Reports
Backport:
Backport:
Duplicate:
Duplicate:
Relates:

Sub Tasks

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

Looks like this is caused by fix for
   6339881: GTK look and feel does not adapt text antialiasing at runtime
                                     
2006-03-13
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



Hardware and Software, Engineered to Work Together