Modify

Opened 5 years ago

Closed 5 years ago

#12981 closed defect (fixed)

[Patch] crash dialg right after loading data after startup: Null pointer at org.openstreetmap.josm.plugins.rasterfilters.RasterFiltersPlugin.activeLayerChange

Reported by: grinapo Owned by: team
Priority: normal Milestone: 16.06
Component: Core Version: latest
Keywords: gsoc-core Cc: michael2402

Description

What steps will reproduce the problem?

  1. start josm
  2. load data and notes from slippy map
  3. you are here

What is the expected result?

No crash dialog.

What happens instead?

Crash dialog.
Nothing special was done, crash appears just at the end of the loading, so far every time. It has been present in yesterday's -latest as well (but I thought it's because plugins demanded newer version than the lastest...).

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

URL:http://josm.openstreetmap.de/svn/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2016-06-17 02:58:36 +0200 (Fri, 17 Jun 2016)
Build-Date:2016-06-17 01:34:23
Revision:10409
Relative:URL: ^/trunk

Identification: JOSM/1.5 (10409 en) Linux Debian GNU/Linux unstable (sid)
Memory Usage: 355 MB / 7131 MB (155 MB allocated, but free)
Java version: 1.8.0_77-internal-b03, Oracle Corporation, OpenJDK 64-Bit Server VM
WebStart package: icedtea-netx:amd64-1.6.2-2
VM arguments: [-Dicedtea-web.bin.name=javaws, -Dicedtea-web.bin.location=/usr/bin/javaws, -Djava.security.manager, -Djava.security.policy=/etc/icedtea-web/javaws.policy]
Dataset consistency test: No problems found

Plugins:
- AddrInterpolation (32158)
- DirectUpload (32158)
- FixAddresses (32158)
- HouseNumberTaggingTool (31926)
- InfoMode (32158)
- Mapillary (32158)
- OpeningHoursEditor (32158)
- PicLayer (32158)
- RoadSigns (32177)
- alignways (32161)
- apache-commons (32158)
- apache-http (32158)
- buildings_tools (32158)
- contourmerge (1014)
- dataimport (32287)
- download_along (32158)
- ejml (32158)
- ext_tools (32158)
- fieldpapers (v0.4.0)
- geochat (32158)
- geotools (31895)
- gpsblam (32158)
- gpxfilter (31923)
- graphview (32158)
- gson (32158)
- imagery_offset_db (32158)
- jna (32158)
- josm-plugin-opengl (1440156917)
- jts (31906)
- junctionchecking (32158)
- log4j (32158)
- mapdust (31923)
- measurement (32158)
- merge-overlap (32158)
- opendata (32289)
- osmarender (31772)
- pbf (32290)
- photo_geotagging (32158)
- rasterfilters (32158)
- reltoolbox (32158)
- reverter (32158)
- routing (32158)
- scripting (30723)
- tageditor (32158)
- turnlanes (32158)
- turnrestrictions (32158)
- undelete (32158)
- utilsplugin2 (32158)
- walkingpapers (32158)
- waypoint_search (32158)

Tagging presets:
- http://osmtools.de/josm/steps.xml
- http://somewhere.dk/email/josm/source.xml
- https://josm.openstreetmap.de/josmfile?page=Presets/BicycleJunction&preset&zip=1
- https://josm.openstreetmap.de/josmfile?page=Presets/Crafts&zip=1
- https://josm.openstreetmap.de/josmfile?page=Presets/Maxspeed-zones&zip=1
- https://josm.openstreetmap.de/josmfile?page=Presets/NewTags&zip=1
- https://josm.openstreetmap.de/josmfile?page=Presets/OneClick&zip=1
- https://josm.openstreetmap.de/josmfile?page=Presets/OpenPisteMap&preset&zip=1
- https://josm.openstreetmap.de/josmfile?page=Presets/OpenPisteMap&zip=1
- https://josm.openstreetmap.de/josmfile?page=Presets/SkiingTrail&zip=1
- https://josm.openstreetmap.de/josmfile?page=Presets/Turistautkapcsolat&zip=1
- https://josm.openstreetmap.de/josmfile?page=Presets/geoimage.at&preset&zip=1

Map paint styles:
- <josm.pref>/ebdirigo/style.zip
- <josm.pref>/<user.name>/BikeNoAccess.mapcss
- <josm.pref>/<user.name>/SurfaceTracktype.mapcss
- <josm.pref>/<user.name>/heyjoe_tuhu_unprocessed.mapcss
- http://kolesar.turistautak.hu/osm/styles/measurements.mapcss
- https://drive.google.com/uc?export=download&id=0ByBzOup047W9UWo0SWpoSzZOQVE
- https://josm.openstreetmap.de/josmfile?page=Styles/Cycleways&style&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Fixme&style&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/HU-HighlightHikingTrailSigns&style&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Landcover&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Lane_and_Road_Attributes&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Lane_features&style&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Lane_features_ryg&style&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Lit&style&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Maxspeed&style&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/MaxspeedIcons&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Modified&style&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Noname&style&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/NumberedWalkingNodeNetworks&style&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Osmc&style&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Sidewalks&style&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Surface&style&zip=1

Last errors/warnings:
- W: Old style SideButton usage for action org.openstreetmap.josm.plugins.JunctionChecker.JunctionCheckDialog$1@4e98e6c6
- W: Old style SideButton usage for action org.openstreetmap.josm.plugins.JunctionChecker.JunctionCheckDialog$2@533b39b3
- W: Old style SideButton usage for action org.openstreetmap.josm.plugins.JunctionChecker.JunctionCheckDialog$3@cf8c393
- W: Old style SideButton usage for action org.openstreetmap.josm.plugins.graphview.plugin.dialogs.GraphViewDialog$1@70e45b21
- E: java.lang.reflect.InvocationTargetException. Cause: java.lang.NullPointerException

java.lang.reflect.InvocationTargetException
	at java.awt.EventQueue.invokeAndWait(EventQueue.java:1321)
	at java.awt.EventQueue.invokeAndWait(EventQueue.java:1296)
	at org.openstreetmap.josm.gui.PleaseWaitRunnable.doRealRun(PleaseWaitRunnable.java:98)
	at org.openstreetmap.josm.gui.PleaseWaitRunnable.run(PleaseWaitRunnable.java:159)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
	at org.openstreetmap.josm.plugins.rasterfilters.RasterFiltersPlugin.activeLayerChange(RasterFiltersPlugin.java:68)
	at org.openstreetmap.josm.gui.MapView$LayerChangeAdapter.activeOrEditLayerChanged(MapView.java:227)
	at org.openstreetmap.josm.gui.layer.MainLayerManager.fireActiveLayerChange(MainLayerManager.java:193)
	at org.openstreetmap.josm.gui.layer.MainLayerManager.setActiveLayer(MainLayerManager.java:186)
	at org.openstreetmap.josm.gui.layer.MainLayerManager.realSetActiveLayer(MainLayerManager.java:175)
	at org.openstreetmap.josm.gui.layer.MainLayerManager$1.run(MainLayerManager.java:167)
	at org.openstreetmap.josm.gui.util.GuiHelper.runInEDTAndWaitWithException(GuiHelper.java:146)
	at org.openstreetmap.josm.gui.layer.MainLayerManager.setActiveLayer(MainLayerManager.java:164)
	at org.openstreetmap.josm.gui.layer.MainLayerManager.realAddLayer(MainLayerManager.java:204)
	at org.openstreetmap.josm.gui.layer.LayerManager$1.run(LayerManager.java:137)
	at org.openstreetmap.josm.gui.util.GuiHelper.runInEDTAndWaitWithException(GuiHelper.java:146)
	at org.openstreetmap.josm.gui.layer.LayerManager.addLayer(LayerManager.java:134)
	at org.openstreetmap.josm.Main.addLayer(Main.java:825)
	at org.openstreetmap.josm.Main.addLayer(Main.java:813)
	at org.openstreetmap.josm.Main.addLayer(Main.java:800)
	at org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask$AbstractInternalTask.addNewLayerIfRequired(DownloadOsmTask.java:263)
	at org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask$AbstractInternalTask.loadData(DownloadOsmTask.java:270)
	at org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask$DownloadTask.finish(DownloadOsmTask.java:352)
	at org.openstreetmap.josm.gui.PleaseWaitRunnable$1.run(PleaseWaitRunnable.java:101)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:109)
	at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:184)
	at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:229)
	at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:227)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:227)
	at java.awt.Dialog.show(Dialog.java:1084)
	at java.awt.Component.show(Component.java:1673)
	at java.awt.Component.setVisible(Component.java:1625)
	at java.awt.Window.setVisible(Window.java:1014)
	at java.awt.Dialog.setVisible(Dialog.java:1005)
	at org.openstreetmap.josm.gui.progress.PleaseWaitProgressMonitor$4.run(PleaseWaitProgressMonitor.java:197)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

Attachments (1)

patch-layer-manager-fire-listener-on-mapview-creation.patch (4.5 KB) - added by michael2402 5 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 5 years ago by bastiK

Cc: michael2402 added
Keywords: template_report removed

comment:2 Changed 5 years ago by michael2402

I'll have a look into it.

Cause: MapView is now initialized in the layerAdded() of the first layer. This means that adding a layer change listener then will make you lose the first layer. This is no problem when using the layer manager but I'll add a fix so that listeners to the map view show the old behavior.

While doing that, I would like to change that plugin to make the filter button only depend on the active layer. Whenever the active layer is null, the filter button can be removed. This only happens if there are no layers that can be active. That way we have a clean state.

Last edited 5 years ago by michael2402 (previous) (diff)

comment:3 Changed 5 years ago by Don-vip

Component: CorePlugin rasterfilters
Owner: changed from team to Nipel-Crumple

comment:4 Changed 5 years ago by michael2402

I added some code to work around this and mimic the old behavior of the layer listeners. It's not nice to add that global field to MapView but it works ;-).

Displaying the map view is now triggered directly after adding that layer to the main layer manager. Plugins may not expect this.

I added a warning for plugin authors to fix it. Plugin authors should register a listener on Main.getLayerManager() when their plugin is loaded.

Last edited 5 years ago by michael2402 (previous) (diff)

comment:5 Changed 5 years ago by Don-vip

Wouldn't be simpler to fix the plugin? Have you tried to load a lot of plugins and see how many of them raise the warning?

comment:6 Changed 5 years ago by michael2402

Milestone: 16.06
Summary: crash dialg right after loading data after startup: Null pointer at org.openstreetmap.josm.plugins.rasterfilters.RasterFiltersPlugin.activeLayerChange[Patch] crash dialg right after loading data after startup: Null pointer at org.openstreetmap.josm.plugins.rasterfilters.RasterFiltersPlugin.activeLayerChange
Version: latest

comment:7 Changed 5 years ago by michael2402

On a first test I found:

  • JunctionCheckerPlugin#mapFrameInitialized
  • ContourMergeModelManager#wireToJOSM
  • MapdustPlugin#mapFrameInitialized
  • GraphViewPlugin#mapFrameInitialized

There may be more...

Adding and removing the layer listeners does not really change anything, so the layer listener could be registered once in the constructor of the plugin.

comment:8 Changed 5 years ago by Don-vip

Component: Plugin rasterfiltersCore
Keywords: gsoc-core added
Owner: changed from Nipel-Crumple to team

comment:9 Changed 5 years ago by Don-vip

Resolution: fixed
Status: newclosed

In 10412/josm:

fix #12981 - mimic the old behavior of the layer listeners (patch by michael2402) - gsoc-core

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.

Add Comment


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

 
Note: See TracTickets for help on using tickets.