Modify

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#20962 closed defect (fixed)

[Patch] NPE changing colour on GPX markers layer

Reported by: alester Owned by: team
Priority: normal Milestone: 21.06
Component: Core Version: tested
Keywords: template_report gpx marker color regression Cc:

Description (last modified by alester)

What steps will reproduce the problem?

  1. Open a GPX file containing waypoints
  2. Delete the layer named after the GPX file
  3. Right-click on the "Markers from..." GPX file layer and select "Customize color"
  4. Select a colour and click OK

What is the expected result?

The colour of the markers should be changed

What happens instead?

An exception dialog is displayed. After closing the dialog and changing zoom level, the colour change does take effect.

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

If it makes any difference, the GPX file was created on a Garmin Oregon 700 device.

URL:https://josm.openstreetmap.de/svn/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2021-06-02 22:03:39 +0200 (Wed, 02 Jun 2021)
Build-Date:2021-06-02 20:11:30
Revision:17919
Relative:URL: ^/trunk

Identification: JOSM/1.5 (17919 en) Windows 10 64-Bit
OS Build number: Windows 10 Pro 2004 (19041)
Memory Usage: 638 MB / 7282 MB (345 MB allocated, but free)
Java version: 1.8.0_291-b10, Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM
Look and Feel: com.sun.java.swing.plaf.windows.WindowsLookAndFeel
Screen: \Display0 1920×1080 (scaling 1.00×1.00) \Display1 1920×1080 (scaling 1.00×1.00)
Maximum Screen Size: 1920×1080
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_US
Numbers with default locale: 1234567890 -> 1234567890

Plugins:
+ FixAddresses (35640)
+ ImportImagePlugin (35567)
+ PicLayer (1.0.1)
+ apache-commons (35524)
+ canvec_helper (35458)
+ ejml (35458)
+ geotools (35458)
+ jaxb (35543)
+ jogl (1.2.3)
+ jts (35458)
+ log4j (35458)
+ measurement (35640)
+ opendata (35640)
+ pbf (35720)
+ poly (35640)
+ reltoolbox (35640)
+ reverter (35732)
+ routing (35640)
+ terracer (35640)
+ todo (30306)
+ turnrestrictions (35640)
+ utilsplugin2 (35691)

Tagging presets:
+ https://josm.openstreetmap.de/josmfile?page=Presets/OneClick&zip=1

Map paint styles:
+ https://josm.openstreetmap.de/josmfile?page=Styles/Maxspeed&zip=1

Last errors/warnings:
- 00094.907 E: Failed to locate image 'Block, Green'
- 00094.908 E: Failed to locate image 'Flag, Blue'
- 00094.908 E: Failed to locate image 'Block, Green'
- 00094.909 E: Failed to locate image 'Block, Green'
- 00094.910 E: Failed to locate image 'Block, Green'
- 00094.911 E: Failed to locate image 'Block, Green'
- 00094.912 E: Failed to locate image 'Block, Green'
- 00094.914 E: Failed to locate image 'Block, Green'
- 00094.915 E: Failed to locate image 'Block, Green'
- 00100.669 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.preferences.display.GPXSettingsPanel.putLayerPrefLocal(GPXSettingsPanel.java:268)
	at org.openstreetmap.josm.gui.preferences.display.GPXSettingsPanel.putLayerPrefLocal(GPXSettingsPanel.java:254)
	at org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer.setColor(MarkerLayer.java:483)
	at org.openstreetmap.josm.gui.layer.CustomizeColor.lambda$actionPerformed$0(CustomizeColor.java:87)
	at java.util.ArrayList.forEach(Unknown Source)
	at org.openstreetmap.josm.gui.layer.CustomizeColor.actionPerformed(CustomizeColor.java:87)
	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)

Attachments (1)

Waypoints_2021-05-21.gpx (1.3 KB ) - added by alester 3 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 by skyper, 3 years ago

Keywords: gpx marker added

comment:2 by skyper, 3 years ago

Keywords: color added

comment:3 by Bjoeni, 3 years ago

Could you please upload the original GPX file that caused this issue?

by alester, 3 years ago

Attachment: Waypoints_2021-05-21.gpx added

comment:4 by alester, 3 years ago

I've experienced the issue with any Garmin-generated waypoint file recently. I haven't tested with non-Garmin files. I've uploaded an example.

While testing to confirm just now, I realized that my workflow is a bit different from what I originally listed. I'm normally only interested in the "Markers from..." layer, so I always delete the other layer that's created when I open a GPX file (named after the file). I'm actually not even sure why there are two layers or what this other one is intended to be used for. If I leave this layer in place, I can change the colour of the markers layer successfully with no errors. It's only when I delete the GPX layer that I get the exception when changing the colour of the markers. I'll update the steps to reproduce.

Last edited 3 years ago by alester (previous) (diff)

comment:5 by alester, 3 years ago

Description: modified (diff)

in reply to:  4 comment:6 by Bjoeni, 3 years ago

Keywords: regression added
Owner: changed from team to Bjoeni
Status: newassigned

Replying to alester:

It's only when I delete the GPX layer that I get the exception when changing the colour of the markers.

Yes, that's it. Thanks!

(regression of #16796)

comment:7 by Bjoeni, 3 years ago

Milestone: 21.06
Owner: changed from Bjoeni to team
Status: assignednew
Summary: Changing colour on GPX markers layer generates exception[Patch] Changing colour on GPX markers layer generates exception
Version: tested
  • src/org/openstreetmap/josm/gui/preferences/display/GPXSettingsPanel.java

     
    250250     * @param value the value or <code>null</code> to remove key
    251251     */
    252252    public static void putLayerPrefLocal(GpxLayer layer, String key, String value) {
    253         if (layer == null) return;
     253        if (layer == null || layer.data == null) return;
    254254        putLayerPrefLocal(layer.data, key, value);
    255255    }

comment:8 by Bjoeni, 3 years ago

See also #20913, the WIP patch there happens to fix this issue as well. But in case that one doesn't make it for 21.06, this one should probably be fixed first.

comment:9 by Don-vip, 3 years ago

Summary: [Patch] Changing colour on GPX markers layer generates exception[Patch] NPE changing colour on GPX markers layer

comment:10 by Don-vip, 3 years ago

Resolution: fixed
Status: newclosed

In 17997/josm:

fix #20962 - fix NPE changing colour on GPX markers layer (patch by Bjoeni)

comment:11 by Don-vip, 3 years ago

Ticket #20772 has been marked as a duplicate of this ticket.

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.