Modify

Opened 12 years ago

Closed 12 years ago

#1403 closed defect (fixed)

Error when opening preferences after start.

Reported by: Tiny Owned by: stoecker
Priority: major Milestone:
Component: Core Version:
Keywords: Cc:

Description

Hi, I got the following error when I tried to open the preferences dialog (via the shortcut button). This happened immediately after I started the josm-latest.jar (downloaded 2008.08.11 16:50 UTC). Error message follows.

Path: trunk
URL: http://josm.openstreetmap.de/svn/trunk
Repository Root: http://josm.openstreetmap.de/svn
Repository UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Revision: 761
Node Kind: directory
Last Changed Author: gebner
Last Changed Rev: 761
Last Changed Date: 2008-08-08 18:25:59 +0200 (Fri, 08 Aug 2008)

java.lang.NullPointerException

at javax.swing.JComponent.setBorder(JComponent.java:1777)
at javax.swing.DefaultListCellRenderer.getListCellRendererComponent(DefaultListCellRenderer.java:159)
at org.openstreetmap.josm.gui.preferences.ToolbarPreferences$1.getListCellRendererComponent(ToolbarPreferences.java:114)
at javax.swing.plaf.basic.BasicListUI.updateLayoutState(BasicListUI.java:1355)
at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(BasicListUI.java:1305)
at javax.swing.plaf.basic.BasicListUI.getPreferredSize(BasicListUI.java:572)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1643)
at javax.swing.JList.getPreferredScrollableViewportSize(JList.java:2399)
at javax.swing.ViewportLayout.preferredLayoutSize(ViewportLayout.java:92)
at java.awt.Container.preferredSize(Container.java:1665)
at java.awt.Container.getPreferredSize(Container.java:1650)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1645)
at javax.swing.ScrollPaneLayout.preferredLayoutSize(ScrollPaneLayout.java:492)
at java.awt.Container.preferredSize(Container.java:1665)
at java.awt.Container.getPreferredSize(Container.java:1650)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1645)
at java.awt.GridBagLayout.GetLayoutInfo(GridBagLayout.java:1109)
at java.awt.GridBagLayout.getLayoutInfo(GridBagLayout.java:910)
at java.awt.GridBagLayout.preferredLayoutSize(GridBagLayout.java:730)
at java.awt.Container.preferredSize(Container.java:1665)
at java.awt.Container.getPreferredSize(Container.java:1650)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1645)
at org.openstreetmap.josm.gui.preferences.ToolbarPreferences$4.preferredLayoutSize(ToolbarPreferences.java:184)
at java.awt.Container.preferredSize(Container.java:1665)
at java.awt.Container.getPreferredSize(Container.java:1650)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1645)
at java.awt.GridBagLayout.GetLayoutInfo(GridBagLayout.java:1109)
at java.awt.GridBagLayout.getLayoutInfo(GridBagLayout.java:910)
at java.awt.GridBagLayout.preferredLayoutSize(GridBagLayout.java:730)
at java.awt.Container.preferredSize(Container.java:1665)
at java.awt.Container.getPreferredSize(Container.java:1650)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1645)
at javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.calculateSize(BasicTabbedPaneUI.java:2296)
at javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.preferredLayoutSize(BasicTabbedPaneUI.java:2270)
at java.awt.Container.preferredSize(Container.java:1665)
at java.awt.Container.getPreferredSize(Container.java:1650)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1645)
at java.awt.GridBagLayout.GetLayoutInfo(GridBagLayout.java:1109)
at java.awt.GridBagLayout.getLayoutInfo(GridBagLayout.java:910)
at java.awt.GridBagLayout.preferredLayoutSize(GridBagLayout.java:730)
at java.awt.Container.preferredSize(Container.java:1665)
at java.awt.Container.getPreferredSize(Container.java:1650)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1645)
at java.awt.GridBagLayout.GetLayoutInfo(GridBagLayout.java:1109)
at java.awt.GridBagLayout.getLayoutInfo(GridBagLayout.java:910)
at java.awt.GridBagLayout.preferredLayoutSize(GridBagLayout.java:730)
at java.awt.Container.preferredSize(Container.java:1665)
at java.awt.Container.getPreferredSize(Container.java:1650)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1645)
at java.awt.BorderLayout.preferredLayoutSize(BorderLayout.java:719)
at java.awt.Container.preferredSize(Container.java:1665)
at java.awt.Container.getPreferredSize(Container.java:1650)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1645)
at java.awt.BorderLayout.preferredLayoutSize(BorderLayout.java:719)
at java.awt.Container.preferredSize(Container.java:1665)
at java.awt.Container.getPreferredSize(Container.java:1650)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1645)
at javax.swing.BoxLayout.checkRequests(BoxLayout.java:481)
at javax.swing.BoxLayout.preferredLayoutSize(BoxLayout.java:298)
at javax.swing.plaf.basic.BasicOptionPaneUI.getPreferredSize(BasicOptionPaneUI.java:270)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1643)
at java.awt.BorderLayout.preferredLayoutSize(BorderLayout.java:719)
at java.awt.Container.preferredSize(Container.java:1665)
at java.awt.Container.getPreferredSize(Container.java:1650)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1645)
at javax.swing.JRootPane$RootLayout.preferredLayoutSize(JRootPane.java:911)
at java.awt.Container.preferredSize(Container.java:1665)
at java.awt.Container.getPreferredSize(Container.java:1650)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1645)
at java.awt.BorderLayout.preferredLayoutSize(BorderLayout.java:719)
at java.awt.Container.preferredSize(Container.java:1665)
at java.awt.Container.getPreferredSize(Container.java:1650)
at java.awt.Window.pack(Window.java:700)
at javax.swing.JOptionPane.initDialog(JOptionPane.java:988)
at javax.swing.JOptionPane.createDialog(JOptionPane.java:969)
at javax.swing.JOptionPane.createDialog(JOptionPane.java:920)
at org.openstreetmap.josm.actions.PreferencesAction.actionPerformed(PreferencesAction.java:41)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2012)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2335)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:404)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:253)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
at java.awt.Component.processMouseEvent(Component.java:6106)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3276)
at java.awt.Component.processEvent(Component.java:5871)
at java.awt.Container.processEvent(Container.java:2105)
at java.awt.Component.dispatchEventImpl(Component.java:4467)
at java.awt.Container.dispatchEventImpl(Container.java:2163)
at java.awt.Component.dispatchEvent(Component.java:4293)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4461)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4125)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4055)
at java.awt.Container.dispatchEventImpl(Container.java:2149)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4293)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:604)
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)

Attachments (2)

0001-gtk-patch.patch (3.7 KB) - added by JohannesRudolph 12 years ago.
Workaround for JDK Problem
0001-gtk-patch.2.patch (3.6 KB) - added by JohannesRudolph 12 years ago.
Workaround for JDK Problem

Download all attachments as: .zip

Change History (9)

comment:1 Changed 12 years ago by anonymous

Duplicate. See #1364.

comment:2 Changed 12 years ago by JohannesRudolph

Owner: changed from framm to anonymous
Status: newassigned

Duplicate of #791,#800,#1163,#1315,#1364,#1378.

comment:3 Changed 12 years ago by JohannesRudolph

See http://bugs.sun.com/view_bug.do?bug_id=6624717 .

Seems like a JDK bug:
It happes like that:

Changed 12 years ago by JohannesRudolph

Attachment: 0001-gtk-patch.patch added

Workaround for JDK Problem

Changed 12 years ago by JohannesRudolph

Attachment: 0001-gtk-patch.2.patch added

Workaround for JDK Problem

comment:4 Changed 12 years ago by JohannesRudolph

Owner: changed from anonymous to stoecker
Status: assignednew

I posted a patch which wraps the problematic border so that default Insets will be given back instead of null.

The second patch has slightly better indentation than the first.

comment:6 Changed 12 years ago by JohannesRudolph

The problem is this:

  • The ToolbarPreferences are initialized in the static initializer of Main.
  • The LookAndFeel is initialized in Main.preConstructorInit
  • Internal data structures of GUI elements used in ToolbarPreferences are not initialized properly to use the later set LAF

Solution:

  • Initialize ToolbarPreferences after the LAF
  • src/org/openstreetmap/josm/Main.java

     src/org/openstreetmap/josm/Main.java |    3 ++-
     1 files changed, 2 insertions(+), 1 deletions(-)
    
    diff --git a/src/org/openstreetmap/josm/Main.java b/src/org/openstreetmap/josm/Main.java
    index 345d062..fcd3cae 100644
    a b abstract public class Main { 
    111111        /**
    112112         * The toolbar preference control to register new actions.
    113113         */
    114         public static ToolbarPreferences toolbar = new ToolbarPreferences();
     114        public static ToolbarPreferences toolbar;
    115115
    116116
    117117        public UndoRedoHandler undoRedo = new UndoRedoHandler();
    abstract public class Main { 
    344344
    345345                try {
    346346                        UIManager.setLookAndFeel(Main.pref.get("laf"));
     347                        toolbar = new ToolbarPreferences();
    347348                        contentPane.updateUI();
    348349                        panel.updateUI();
    349350                } catch (final Exception e) {

comment:7 Changed 12 years ago by anonymous

Resolution: fixed
Status: newclosed

Applied in r776.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain stoecker.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.