Index: applications/editors/josm/plugins/OsmInspectorPlugin/.classpath
===================================================================
--- applications/editors/josm/plugins/OsmInspectorPlugin/.classpath	(revision 30827)
+++ applications/editors/josm/plugins/OsmInspectorPlugin/.classpath	(revision 30828)
@@ -2,19 +2,50 @@
 <classpath>
 	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="lib" path="lib/gt-api-8.0.jar"/>
-	<classpathentry kind="lib" path="lib/gt-data-8.0.jar"/>
-	<classpathentry kind="lib" path="lib/gt-main-8.0.jar"/>
-	<classpathentry kind="lib" path="lib/gt-opengis-8.0.jar"/>
-	<classpathentry kind="lib" path="lib/gt-referencing-8.0.jar"/>
-	<classpathentry kind="lib" path="lib/gt-referencing3D-8.0.jar"/>
-	<classpathentry kind="lib" path="lib/gt-render-8.0.jar"/>
-	<classpathentry kind="lib" path="lib/jts-1.12.jar"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
-	<classpathentry kind="lib" path="lib/gt-wfs-8.0.jar"/>
-	<classpathentry kind="lib" path="lib/gt-epsg-extension-8.0.jar"/>
-	<classpathentry kind="lib" path="lib/gt-epsg-hsql-8.0.jar"/>
-	<classpathentry kind="lib" path="lib/gt-metadata-8.0.jar"/>
-	<classpathentry kind="lib" path="lib/gt-coverage-8.0.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/JOSM-jts"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/JOSM-GeoTools"/>
+	<classpathentry kind="lib" path="lib/commons-collections-3.1.jar"/>
+	<classpathentry kind="lib" path="lib/commons-jxpath-1.3.jar"/>
+	<classpathentry kind="lib" path="lib/gt-app-schema-resolver-12.1.jar">
+		<attributes>
+			<attribute name="javadoc_location" value="http://docs.geotools.org/stable/javadocs/"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="lib" path="lib/gt-cql-12.1.jar">
+		<attributes>
+			<attribute name="javadoc_location" value="http://docs.geotools.org/stable/javadocs/"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="lib" path="lib/gt-render-12.1.jar">
+		<attributes>
+			<attribute name="javadoc_location" value="http://docs.geotools.org/stable/javadocs/"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="lib" path="lib/gt-referencing3D-12.1.jar">
+		<attributes>
+			<attribute name="javadoc_location" value="http://docs.geotools.org/stable/javadocs/"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="lib" path="lib/gt-wfs-12.1.jar">
+		<attributes>
+			<attribute name="javadoc_location" value="http://docs.geotools.org/stable/javadocs/"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="lib" path="lib/gt-xml-12.1.jar">
+		<attributes>
+			<attribute name="javadoc_location" value="http://docs.geotools.org/stable/javadocs/"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="lib" path="lib/gt-xsd-core-12.1.jar">
+		<attributes>
+			<attribute name="javadoc_location" value="http://docs.geotools.org/stable/javadocs/"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="lib" path="lib/gt-xsd-wfs-12.1.jar">
+		<attributes>
+			<attribute name="javadoc_location" value="http://docs.geotools.org/stable/javadocs/"/>
+		</attributes>
+	</classpathentry>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
Index: applications/editors/josm/plugins/OsmInspectorPlugin/build.xml
===================================================================
--- applications/editors/josm/plugins/OsmInspectorPlugin/build.xml	(revision 30827)
+++ applications/editors/josm/plugins/OsmInspectorPlugin/build.xml	(revision 30828)
@@ -11,8 +11,14 @@
     <property name="plugin.description" value="Bring in errors from Osm Inspector and display it on the current JOSM bounding box"/>
     <property name="plugin.icon" value="images/osmInspector.jpg"/>
-    <property name="plugin.link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/MapDust"/>
+    <!--<property name="plugin.link" value=""/>-->
+    <property name="plugin.requires" value="jts;geotools"/>
 
     <!-- ** include targets that all plugins have in common ** -->
     <import file="../build-common.xml"/>
 
+	<fileset id="plugin.requires.jars" dir="${plugin.dist.dir}">
+        <include name="jts.jar"/>
+        <include name="geotools.jar"/>
+    </fileset>
+
 </project>
Index: applications/editors/josm/plugins/OsmInspectorPlugin/src/org/openstreetmap/josm/plugins/osminspector/OSMIFeatureTracker.java
===================================================================
--- applications/editors/josm/plugins/OsmInspectorPlugin/src/org/openstreetmap/josm/plugins/osminspector/OSMIFeatureTracker.java	(revision 30827)
+++ applications/editors/josm/plugins/OsmInspectorPlugin/src/org/openstreetmap/josm/plugins/osminspector/OSMIFeatureTracker.java	(revision 30828)
@@ -6,4 +6,5 @@
 import org.geotools.data.memory.MemoryFeatureCollection;
 import org.geotools.feature.FeatureCollection;
+import org.geotools.feature.FeatureIterator;
 import org.opengis.feature.simple.SimpleFeature;
 import org.opengis.feature.simple.SimpleFeatureType;
@@ -34,23 +35,29 @@
 		}
 
-		features.addAll(featuresIn);
+		try (FeatureIterator<SimpleFeature> it = featuresIn.features()) {
+		    while (it.hasNext()) {
+		        features.add(it.next());
+		    }
+		}
 	}
 
 	public boolean mergeFeatures(
 			FeatureCollection<SimpleFeatureType, SimpleFeature> newFeatures) {
-		for (Iterator<SimpleFeature> it = newFeatures.iterator(); it.hasNext();) {
-			SimpleFeature element = (SimpleFeature) it.next();
-			try {
-				Long ID = (Long.parseLong((String) element
-						.getAttribute("problem_id")));
-
-				if (!hashFeatures.containsKey(ID)) {
-					hashFeatures.put(ID, element);
-					features.add(element);
-				}
-			} catch (NumberFormatException e) {
-				continue;
-			}
-		}
+	    try (FeatureIterator<SimpleFeature> it = newFeatures.features()) {
+	        while (it.hasNext()) {
+    			SimpleFeature element = (SimpleFeature) it.next();
+    			try {
+    				Long ID = (Long.parseLong((String) element
+    						.getAttribute("problem_id")));
+    
+    				if (!hashFeatures.containsKey(ID)) {
+    					hashFeatures.put(ID, element);
+    					features.add(element);
+    				}
+    			} catch (NumberFormatException e) {
+    				continue;
+    			}
+    		}
+	    }
 
 		return true;
Index: applications/editors/josm/plugins/OsmInspectorPlugin/src/org/openstreetmap/josm/plugins/osminspector/OsmInspectorLayer.java
===================================================================
--- applications/editors/josm/plugins/OsmInspectorPlugin/src/org/openstreetmap/josm/plugins/osminspector/OsmInspectorLayer.java	(revision 30827)
+++ applications/editors/josm/plugins/OsmInspectorPlugin/src/org/openstreetmap/josm/plugins/osminspector/OsmInspectorLayer.java	(revision 30828)
@@ -25,8 +25,7 @@
 import org.geotools.feature.FeatureCollection;
 import org.geotools.feature.FeatureIterator;
-import org.geotools.filter.Filter;
 import org.geotools.geometry.jts.ReferencedEnvelope;
-import org.geotools.map.DefaultMapContext;
-import org.geotools.map.MapContext;
+import org.geotools.map.FeatureLayer;
+import org.geotools.map.MapContent;
 import org.geotools.referencing.CRS;
 import org.geotools.renderer.lite.StreamingRenderer;
@@ -46,4 +45,5 @@
 import org.opengis.filter.FilterFactory2;
 import org.opengis.filter.identity.FeatureId;
+import org.opengis.filter.spatial.Intersects;
 import org.opengis.referencing.FactoryException;
 import org.opengis.referencing.NoSuchAuthorityCodeException;
@@ -73,5 +73,5 @@
 
 	private SimpleFeatureSource featureSource;
-	private MapContext context;
+	private MapContent content;
 	private boolean bIsChanged;
 
@@ -355,5 +355,5 @@
 		CRS.decode(Main.getProjection().toCode());
 		crsOSMI = CRS.decode("EPSG:4326");
-		context = new DefaultMapContext(crsOSMI);
+		content = new MapContent(crsOSMI);
 
 		selectGeomType.add(GeomType.POINT);
@@ -371,6 +371,5 @@
 			OSMIFeatureTracker tracker = new OSMIFeatureTracker(features);
 			arrFeatures.add(tracker);
-			FeatureIterator<SimpleFeature> it = tracker.getFeatures()
-					.features();
+			FeatureIterator<SimpleFeature> it = tracker.getFeatures().features();
 
 			while (it.hasNext()) {
@@ -379,10 +378,10 @@
 			}
 
-			context.addLayer(tracker.getFeatures(), style);
+			content.addLayer(new FeatureLayer(tracker.getFeatures(), style));
 		}
 
 		osmiIndex = new BugIndex(osmiBugInfo);
-		context.setTitle("Osm Inspector Errors");
-		renderer.setContext(context);
+		content.setTitle("Osm Inspector Errors");
+		renderer.setMapContent(content);
 		bIsChanged = true;
 
@@ -407,5 +406,5 @@
 		String typeNames[] = wfsClient.getTypeNames();
 
-		context.clearLayerList();
+		content.layers().clear();
 		selectGeomType.clear();
 		selectGeomType.add(GeomType.POINT);
@@ -438,5 +437,5 @@
 
 			Style style = createDefaultStyle(idx, selectedFeatures);
-			context.addLayer(tracker.getFeatures(), style);
+			content.addLayer(new FeatureLayer(tracker.getFeatures(), style));
 		}
 
@@ -596,10 +595,10 @@
 		ReferencedEnvelope mapArea = new ReferencedEnvelope(envelope, crsOSMI);
 
-		Filter filter = (Filter) ff.intersects(ff.property("msGeometry"),
+		Intersects filter = ff.intersects(ff.property("msGeometry"),
 				ff.literal(mapArea));
 		//
 		// Select features in all layers
 		//
-		context.clearLayerList();
+		content.layers().clear();
 
 		// Iterate through features and build a list that intersects the above
@@ -615,23 +614,21 @@
 			try {
 				selectedFeatures = tempfs.getFeatures(filter);
-
-				FeatureIterator<SimpleFeature> iter = selectedFeatures.features();
-				Set<FeatureId> IDs = new HashSet<>();
-
-				Main.info("Selected features " + selectedFeatures.size());
-
-				while (iter.hasNext()) {
-					SimpleFeature feature = iter.next();
-					IDs.add(feature.getIdentifier());
+                Set<FeatureId> IDs = new HashSet<>();
+
+				try (FeatureIterator<SimpleFeature> iter = selectedFeatures.features()) {
+    
+    				Main.info("Selected features " + selectedFeatures.size());
+    
+    				while (iter.hasNext()) {
+    					SimpleFeature feature = iter.next();
+    					IDs.add(feature.getIdentifier());
+    				}
 				}
-
-				iter.close();
 
 				geometryType = selectGeomType.get(idx + layerOffset);
 				Style style = createDefaultStyle(idx + layerOffset, IDs);
-				context.addLayer(features, style);
+				content.addLayer(new FeatureLayer(features, style));
 			} catch (IOException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
+				Main.error(e);
 			}
 		}
Index: applications/editors/josm/plugins/OsmInspectorPlugin/src/org/openstreetmap/josm/plugins/osminspector/gui/OsmInspectorDialog.java
===================================================================
--- applications/editors/josm/plugins/OsmInspectorPlugin/src/org/openstreetmap/josm/plugins/osminspector/gui/OsmInspectorDialog.java	(revision 30827)
+++ applications/editors/josm/plugins/OsmInspectorPlugin/src/org/openstreetmap/josm/plugins/osminspector/gui/OsmInspectorDialog.java	(revision 30828)
@@ -44,6 +44,6 @@
 	
 	public void updateNextPrevAction(OsmInspectorLayer l) {
-		this.actNext.layer = l;
-		this.actPrev.layer = l;
+		this.actNext.inspectlayer = l;
+		this.actPrev.inspectlayer = l;
 	}
 	
@@ -164,20 +164,20 @@
 			ListSelectionListener {
 
-		private OsmInspectorLayer layer;
+		private OsmInspectorLayer inspectlayer;
 
 		public OsmInspectorNextAction(Layer inspector) {
 			super("next");
-			layer = (OsmInspectorLayer) inspector;
+			inspectlayer = (OsmInspectorLayer) inspector;
 		}
 
 		@Override
 		public void actionPerformed(ActionEvent e) {
-			layer.getOsmiIndex().next();
-			BugInfo next = layer.getOsmiIndex().getItemPointedByNext();
+			inspectlayer.getOsmiIndex().next();
+			BugInfo next = inspectlayer.getOsmiIndex().getItemPointedByNext();
 			Geometry geom = next.getGeom();
 			Point centroid = geom.getCentroid();
 			LatLon center = new LatLon(centroid.getY(), centroid.getX());
 			Main.map.mapView.zoomTo(center);
-			layer.selectFeatures(center);
+			inspectlayer.selectFeatures(center);
 			bugInfoDialog.setBugDescription(next);
 			updateSelection(next);
@@ -199,20 +199,20 @@
 			ListSelectionListener {
 
-		private OsmInspectorLayer layer;
+		private OsmInspectorLayer inspectlayer;
 
 		public OsmInspectorPrevAction(Layer inspector) {
 			super("prev");
-			layer = (OsmInspectorLayer) inspector;
+			inspectlayer = (OsmInspectorLayer) inspector;
 		}
 
 		@Override
 		public void actionPerformed(ActionEvent e) {
-			layer.getOsmiIndex().prev();
-			BugInfo prev = layer.getOsmiIndex().getItemPointedByPrev();
+			inspectlayer.getOsmiIndex().prev();
+			BugInfo prev = inspectlayer.getOsmiIndex().getItemPointedByPrev();
 			Geometry geom = prev.getGeom();
 			Point centroid = geom.getCentroid();
 			LatLon center = new LatLon(centroid.getY(), centroid.getX());
 			Main.map.mapView.zoomTo(center);
-			layer.selectFeatures(center);
+			inspectlayer.selectFeatures(center);
 			bugInfoDialog.setBugDescription(prev);
 			updateSelection(prev);
