Modify

Opened 5 years ago

Closed 5 years ago

#1532 closed defect (fixed)

JOSM NullPointerException on GPX import in r943

Reported by: anonymous Owned by: framm
Priority: major Component: unspecified
Version: Keywords:
Cc:

Description

  1. Start JOSM
  2. Open a GPX file, I tried several but I've attached one that produces the error for completeness
  3. Get NullPointerException error

Development version. Unknown revision.
java.lang.NullPointerException

at org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer.<init>(MarkerLayer.java:85)
at org.openstreetmap.josm.actions.OpenAction.openFileAsGpx(OpenAction.java:97)
at org.openstreetmap.josm.actions.OpenAction.openFile(OpenAction.java:58)
at org.openstreetmap.josm.actions.OpenAction.actionPerformed(OpenAction.java:49)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1220)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1261)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
at java.awt.Component.processMouseEvent(Component.java:6041)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
at java.awt.Component.processEvent(Component.java:5806)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4413)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4243)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2440)
at java.awt.Component.dispatchEvent(Component.java:4243)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
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)

Attachments (3)

waypoint.gpx (213.8 KB) - added by anonymous 5 years ago.
MarkerLayer.java.patch (1.3 KB) - added by avar 5 years ago.
Check whether wpt.attr.containsKey("link") before iterating over the wpt.attr.get("link") Collection
MarkerLayer.java.2.patch (1.2 KB) - added by avar 5 years ago.
FIXED PATCH: Check whether wpt.attr.containsKey("link") before iterating over the wpt.attr.get("link") Collection

Download all attachments as: .zip

Change History (6)

Changed 5 years ago by anonymous

comment:1 Changed 5 years ago by avar

This also has the effect of GPX waypoints not being displayed in the UI, the revision that broke it is r941:942 and the problem is that there was code added that presumes that all GPX waypoints contain a <link> element

The following patch fixes it:

Changed 5 years ago by avar

Check whether wpt.attr.containsKey("link") before iterating over the wpt.attr.get("link") Collection

Changed 5 years ago by avar

FIXED PATCH: Check whether wpt.attr.containsKey("link") before iterating over the wpt.attr.get("link") Collection

comment:2 Changed 5 years ago by avar

The first patch I submitted was a broken work in progress, the second one works.

comment:3 Changed 5 years ago by anonymous

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in r944.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed .
as The resolution will be set. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.