Modify

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#21658 closed defect (duplicate)

NPE in org.openstreetmap.josm.gui.tagging.presets.items.PresetListEntry.getCount

Reported by: noen Owned by: team
Priority: normal Milestone:
Component: Core Version: tested
Keywords: template_report Cc:

Description

What steps will reproduce the problem?

  1. Create a custom preset with a chunk block with two list entries and two combo boxes that reuses the same chunk.
  2. Try to open said preset.

What happens instead?

Preset won't open at all.

Please provide any additional information below. Attach a screenshot if possible.

Build-Date:2021-11-01 22:53:13
Revision:18303

Identification: JOSM/1.5 (18303 en) Windows 10 64-Bit
OS Build number: Windows 10 Pro 2009 (19043)
Memory Usage: 502 MB / 3630 MB (245 MB allocated, but free)
Java version: 1.8.0_311-b11, Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM
Look and Feel: com.sun.java.swing.plaf.windows.WindowsLookAndFeel
Screen: \Display0 2560×1440 (scaling 1.00×1.00)
Maximum Screen Size: 2560×1440
Best cursor sizes: 16×16→32×32, 32×32→32×32
System property file.encoding: Cp1252
System property sun.jnu.encoding: Cp1252
Locale info: en_NO
Numbers with default locale: 1234567890 -> 1234567890
VM arguments: [-Djosm.home=JOSM-test]
Dataset consistency test: No problems found

Plugins:
+ PicLayer (1.0.1)
+ utilsplugin2 (35856)

Tagging presets:
+ .\own_preset.xml

Last errors/warnings:
- 00753.437 E: Handled by bug report queue: java.lang.NullPointerException



=== REPORTED CRASH DATA ===
BugReportExceptionHandler#handleException:
No data collected.

Warning issued by: BugReportExceptionHandler#handleException

=== STACK TRACE ===
Thread: AWT-EventQueue-0 (19) of main
java.lang.NullPointerException
	at org.openstreetmap.josm.gui.tagging.presets.items.PresetListEntry.getCount(PresetListEntry.java:191)
	at org.openstreetmap.josm.gui.tagging.presets.items.PresetListEntry.getListDisplay(PresetListEntry.java:85)
	at org.openstreetmap.josm.gui.tagging.presets.items.ComboMultiSelect$ComboMultiSelectListCellRenderer.getListCellRendererComponent(ComboMultiSelect.java:139)
	at org.openstreetmap.josm.gui.tagging.presets.items.ComboMultiSelect$ComboMultiSelectListCellRenderer.getListCellRendererComponent(ComboMultiSelect.java:104)
	at javax.swing.plaf.basic.BasicListUI.updateLayoutState(Unknown Source)
	at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(Unknown Source)
	at javax.swing.plaf.basic.BasicListUI$Handler.valueChanged(Unknown Source)
	at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown Source)
	at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown Source)
	at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown Source)
	at javax.swing.DefaultListSelectionModel.changeSelection(Unknown Source)
	at javax.swing.DefaultListSelectionModel.changeSelection(Unknown Source)
	at javax.swing.DefaultListSelectionModel.setSelectionInterval(Unknown Source)
	at javax.swing.JList.setSelectedIndex(Unknown Source)
	at javax.swing.plaf.basic.BasicComboPopup.setListSelection(Unknown Source)
	at javax.swing.plaf.basic.BasicComboPopup.access$300(Unknown Source)
	at javax.swing.plaf.basic.BasicComboPopup$Handler.itemStateChanged(Unknown Source)
	at javax.swing.JComboBox.fireItemStateChanged(Unknown Source)
	at javax.swing.JComboBox.selectedItemChanged(Unknown Source)
	at javax.swing.JComboBox.contentsChanged(Unknown Source)
	at javax.swing.AbstractListModel.fireContentsChanged(Unknown Source)
	at org.openstreetmap.josm.gui.widgets.JosmComboBoxModel.setSelectedItem(JosmComboBoxModel.java:149)
	at javax.swing.JComboBox.setSelectedItem(Unknown Source)
	at org.openstreetmap.josm.gui.tagging.presets.items.Combo.addToPanel(Combo.java:159)
	at org.openstreetmap.josm.gui.tagging.presets.TaggingPreset.createPanel(TaggingPreset.java:435)
	at org.openstreetmap.josm.gui.tagging.presets.TaggingPreset.showDialog(TaggingPreset.java:596)
	at org.openstreetmap.josm.gui.tagging.presets.TaggingPreset.showAndApply(TaggingPreset.java:508)
	at org.openstreetmap.josm.gui.tagging.presets.TaggingPreset.actionPerformed(TaggingPreset.java:498)
	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at javax.swing.AbstractButton.doClick(Unknown Source)
	at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
	at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.awt.EventQueue.access$500(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

own_preset.xml

<?xml version="1.0" encoding="UTF-8"?>
<presets xmlns="http://josm.openstreetmap.de/tagging-preset-1.0">
  <chunk id="test_chunk">
    <list_entry value="one"/>
    <list_entry value="two"/>
  </chunk>
  <group name="Test">
    <item name="Preset" type="way">
      <combo key="box 1">
        <reference ref="test_chunk"/>
      </combo>
      <combo key="box 2">
        <reference ref="test_chunk"/>
      </combo>
    </item>
  </group>
</presets>

Attachments (0)

Change History (4)

comment:1 by skyper, 3 years ago

  • white spaces in keys are invalid
  • chunks have some limitations, so far. One is that <list_entry /> can not be used on their own but need a surrounding <combo> or <multiselect>. Another e.g. is that <items> and <group> cannot be inside a chunk.

comment:2 by noen, 3 years ago

I have a more extensive custom preset that apparently worked fine one older version of JOSM. It have <list_entry /> inside a chunk. I am yet to identify which version of JOSM it worked one last.
As seen by my example it still works if you referee to a chunk only once. If you delete <combo key="box 2">, Test/Preset open as expected.

Here is a new example without any white spaces in keys:

<?xml version="1.0" encoding="UTF-8"?>
<presets xmlns="http://josm.openstreetmap.de/tagging-preset-1.0">
  <chunk id="test_chunk">
    <list_entry value="one"/>
    <list_entry value="two"/>
  </chunk>
  <group name="Test">
    <item name="Preset" type="way">
      <combo text="Box 2" key="box1">
        <reference ref="test_chunk"/>
      </combo>
      <combo text="Box 2" key="box2">
        <reference ref="test_chunk"/>
      </combo>
    </item>
  </group>
</presets>

comment:3 by taylor.smock, 3 years ago

Resolution: duplicate
Status: newclosed
Summary: java.lang.NullPointerException when reusing preset chunkNPE in org.openstreetmap.josm.gui.tagging.presets.items.PresetListEntry.getCount

Closed as duplicate of #21550.
@skyper: This looks like a duplicate of #21550 (same stack trace).

@noen: This should be fixed in JOSM r18327. If this still occurs under josm-latest (there hasn't been a josm-tested release yet with the fix), please reopen this ticket.

in reply to:  2 comment:4 by skyper, 3 years ago

Replying to noen:

I have a more extensive custom preset that apparently worked fine one older version of JOSM. It have <list_entry /> inside a chunk. I am yet to identify which version of JOSM it worked one last.

Maybe, I was wrong about chunks and list_entry. Have to recheck as the last time I tried this, I remember I had some problems. With latest your example works on my system.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.