﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
12157	[Conflation Plugin] NullPointerException when the conflation layer is added to the map	coso	team	"==== What steps will reproduce the problem?
1. Install ""conflation"" plugin and restart JOSM
2. open the attached file subject.osm
3. open the attached file reference.osm
4. click ""Configure"" button on Conflation's toggle dialog
5. select the way in reference.osm layer and click ""Reference --> Freeze""
6. select the way in subject.osm layer and click ""Subject --> Freeze""
7. click ""Generate matches""

==== What is the expected result?
Matches are generated, ""Conflation"" layer is created and added to the map.

==== What happens instead?
Matches are generated, ""Conflation"" layer is created but there is a NullPointerException and the layer is not added to the map.

==== Please provide any additional information below.
- the conflation layer is build with [https://github.com/JOSM/josm-conflation-plugin/blob/master/src/org/openstreetmap/josm/plugins/conflation/ConflationToggleDialog.java#L908 new ConflationLayer()] thus conflationLayer.matches is null

- the layer is then added to the map with [https://github.com/JOSM/josm-conflation-plugin/blob/master/src/org/openstreetmap/josm/plugins/conflation/ConflationToggleDialog.java#L909 Main.main.addLayer(conflationLayer)] but there is a NullPointerException in [https://github.com/JOSM/josm-conflation-plugin/blob/master/src/org/openstreetmap/josm/plugins/conflation/ConflationLayer.java#L121 visitBoundingBox(BoundingXYVisitor v)] because conflationLayer.matches == null.

==== Proposed solution ====
Move Main.main.addLayer(conflationLayer) after [https://github.com/JOSM/josm-conflation-plugin/blob/master/src/org/openstreetmap/josm/plugins/conflation/ConflationToggleDialog.java#L914 conflationLayer.setMatches(matches)]

{{{
URL:http://josm.openstreetmap.de/svn/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2015-11-24 00:04:12 +0100 (Tue, 24 Nov 2015)
Build-Date:2015-11-23 23:14:21
Revision:9060
Relative:URL: ^/trunk

Identification: JOSM/1.5 (9060 it) Linux Ubuntu 15.10
Memory Usage: 335 MB / 876 MB (243 MB allocated, but free)
Java version: 1.7.0_91, Oracle Corporation, OpenJDK 64-Bit Server VM
Java package: openjdk-7-jre:amd64-7u91-2.6.3-0ubuntu0.15.10.1
VM arguments: [-Djosm.restart=true, -Djava.net.useSystemProxies=true]
Dataset consistency test: No problems found

Plugins:
- conflation (0.1.8)
- jts (31772)
- utilsplugin2 (31772)
}}}"	defect	closed	normal		Plugin conflation		fixed	template_report	
