Modify

Opened 2 years ago

Last modified 2 years ago

#22645 needinfo defect

NPE: Cannot invoke "java.util.Collection.iterator()" because "objects" is null

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

Description

What steps will reproduce the problem?

No idea

What is the expected result?

No crash

What happens instead?

Crash

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

Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2023-01-03 21:28:24 +0100 (Tue, 03 Jan 2023)
Revision:18622
Build-Date:2023-01-04 02:30:56
URL:https://josm.openstreetmap.de/svn/trunk

Identification: JOSM/1.5 (18622 en) Linux EndeavourOS Linux
Memory Usage: 646 MB / 3922 MB (120 MB allocated, but free)
Java version: 19.0.1+10, N/A, OpenJDK 64-Bit Server VM
Look and Feel: com.sun.java.swing.plaf.gtk.GTKLookAndFeel
Screen: :0.0 1920×1080 (scaling 1.00×1.00)
Maximum Screen Size: 1920×1080
Best cursor sizes: 16×16→16×16, 32×32→32×32
Environment variable LANG: en_US.UTF-8
System property file.encoding: UTF-8
System property sun.jnu.encoding: UTF-8
Locale info: en_US
Numbers with default locale: 1234567890 -> 1234567890
Desktop environment: GNOME
VM arguments: [--add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED, -Djosm.restart=true]
Dataset consistency test: No problems found

Plugins:
+ ColorPlugin (v1.1.2.1)
+ ImproveWay (32)
+ Mapillary (2.1.1)
+ OpeningHoursEditor (35924)
+ PicLayer (1.0.2)
+ PolygonCutOut (v0.7)
+ Relation.Validation.Plugin (1.0.1)
+ RelationDissolve (0.2.0)
+ Review.Changes (1.0.5)
+ RoadSigns (36011)
+ SimplifyArea (35978)
+ apache-commons (36034)
+ apache-http (35924)
+ auto_tools (81)
+ centernode (v1.0.4)
+ conflation (0.6.9)
+ continuosDownload (105)
+ ejml (35924)
+ fastdriveway (v1.0.1)
+ geotools (36028)
+ jackson (36034)
+ jaxb (35952)
+ jna (36005)
+ josm-batch-downloader (1.0.4)
+ josm_magic_wand (1.1.0)
+ jts (36004)
+ markseen (14)
+ merge-overlap (35893)
+ notesolver (0.4.2)
+ opendata (36025)
+ openindoor-1.0.2-josm (UNKNOWN)
+ openqa (v0.3.3)
+ pdfimport (35976)
+ pt_assistant (1ff2e15)
+ rasterfilters (1.0.3)
+ reltoolbox (35976)
+ reverter (36043)
+ shrinkwrap (v1.0.4)
+ tageditor (36011)
+ todo (30306)
+ tofix (490)
+ turnlanes-tagging (v0.0.5)
+ turnrestrictions (36011)
+ utilsplugin2 (36011)
+ waydownloader (36011)
+ wikipedia (605)

Tagging presets:
+ https://josm.openstreetmap.de/josmfile?page=Presets/ParkingLanes&zip=1
+ C:\Users\cyron\AppData\Roaming\JOSM/EasyPresets.xml
+ <josm.userdata>/EasyPresets.xml

Map paint styles:
- https://josm.openstreetmap.de/josmfile?page=Styles/Enhanced_Lane_and_Road_Attributes&zip=1
- https://raw.githubusercontent.com/species/josm-preset-traffic_sign_direction/master/direction.mapcss
- https://josm.openstreetmap.de/josmfile?page=Styles/light_source&zip=1
- https://github.com/bastik/mapcss-tools/raw/osm/mapnik2mapcss/osm-results/mapnik.zip
- https://raw.githubusercontent.com/OpenNauticalChart/josm/master/BNIWR_MapCSS.mapcss
- https://raw.githubusercontent.com/OpenNauticalChart/josm/master/CEVNI_MapCSS.mapcss
- https://josm.openstreetmap.de/josmfile?page=Styles/LessObtrusiveNodes&zip=1
- https://pasharm.github.io/New_basic_style_for_JOSM/New_basic_style.mapcss
- https://raw.githubusercontent.com/yopaseopor/indoormap/master/indoormap-style.mapcss

Validator rules:
+ https://josm.openstreetmap.de/josmfile?page=Rules/GermanySpecific&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Rules/KeepRight&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Rules/OSMLint&zip=1
+ https://raw.githubusercontent.com/stefan-a-bauer/josm-validators/master/mtb.validator.mapcss
+ https://josm.openstreetmap.de/josmfile?page=Rules/PublicTransportGtfs&zip=1

Last errors/warnings:
- 00009.559 E: java.nio.file.NoSuchFileException: C:\Users\cyron\AppData\Roaming\JOSM/EasyPresets.xml
- 00009.560 E: C:\Users\cyron\AppData\Roaming\JOSM/EasyPresets.xml
- 00009.561 E: java.nio.file.NoSuchFileException: <josm.userdata>/EasyPresets.xml
- 00009.561 E: <josm.userdata>/EasyPresets.xml
- 00016.207 E: Failed to locate image 'bus.png'
- 00816.377 E: java.net.SocketTimeoutException: Read timed out
- 00981.339 E: Failed to locate image '[[Image(pond.png)]]'
- 00981.342 E: Failed to locate image '[[Image(oil-palm.png)]]'
- 01645.200 E: Handled by bug report queue: java.lang.NullPointerException: Cannot invoke "java.util.Collection.iterator()" because "objects" is null



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

Warning issued by: BugReportExceptionHandler#handleException

=== STACK TRACE ===
Thread: AWT-EventQueue-0 (37) of main
java.lang.NullPointerException: Cannot invoke "java.util.Collection.iterator()" because "objects" is null
	at org.openstreetmap.josm.command.ChangePropertyCommand.<init>(ChangePropertyCommand.java:110)
	at org.openstreetmap.josm.gui.dialogs.properties.TagEditHelper$EditTagDialog.performTagEdit(TagEditHelper.java:591)
	at org.openstreetmap.josm.gui.dialogs.properties.TagEditHelper.editTag(TagEditHelper.java:321)
	at org.openstreetmap.josm.gui.dialogs.properties.PropertiesDialog$MouseClickWatch.mouseClicked(PropertiesDialog.java:1125)
	at java.desktop/java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:278)
	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6623)
	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3398)
	at java.desktop/java.awt.Component.processEvent(Component.java:6385)
	at java.desktop/java.awt.Container.processEvent(Container.java:2266)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4995)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4827)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4584)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2780)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4827)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:775)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:747)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:744)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Attachments (0)

Change History (4)

comment:1 by skyper, 2 years ago

Summary: Crash dialog while using JOSMNPE: Cannot invoke "java.util.Collection.iterator()" because "objects" is null

comment:2 by taylor.smock, 2 years ago

Milestone: 23.01
Summary: NPE: Cannot invoke "java.util.Collection.iterator()" because "objects" is null[PATCH] NPE: Cannot invoke "java.util.Collection.iterator()" because "objects" is null

I think this should be a fairly easy fix. I'll see if I can write a non-regression test before I apply the patch though.

  • src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java

    diff --git a/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java b/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
    a b  
    113113    private final Map<String, Map<String, Integer>> valueCount;
    114114
    115115    // Selection that we are editing by using both dialogs
    116     protected Collection<OsmPrimitive> sel;
     116    protected Collection<OsmPrimitive> sel = Collections.emptyList();
    117117
    118118    private String changedKey;
    119119
     
    415415     * @since 14509
    416416     */
    417417    public void resetSelection() {
    418         sel = null;
     418        sel = Collections.emptyList();
    419419    }
    420420
    421421    /**

comment:3 by taylor.smock, 2 years ago

I have no clue how this actually happens though -- the only place our code calls resetSelection is when we change layers, and that should be called only from the EDT, so sel should never be null in JOSM core codepaths.

comment:4 by taylor.smock, 2 years ago

Milestone: 23.01
Owner: changed from team to RubenKelevra
Status: newneedinfo
Summary: [PATCH] NPE: Cannot invoke "java.util.Collection.iterator()" because "objects" is nullNPE: Cannot invoke "java.util.Collection.iterator()" because "objects" is null

Can you give us some idea of what you were doing when the crash happened? I can put in a workaround fairly easily, but something else is going on here.

For example:

  • While using RelationDissolve and editing tags, this crash occurred.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as needinfo The owner will remain RubenKelevra.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from RubenKelevra to the specified user. Next status will be 'new'.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from RubenKelevra to anonymous. Next status will be 'assigned'.

Add Comment


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