Index: trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java	(revision 10115)
+++ trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java	(revision 10116)
@@ -95,5 +95,5 @@
     protected void validateRequest() throws RequestHandlerBadRequestException {
         allCoordinates.clear();
-        for (String coordinatesString : args.get("way").split(";\\s*")) {
+        for (String coordinatesString : (args != null ? args.get("way") : "").split(";\\s*")) {
             String[] coordinates = coordinatesString.split(",\\s*", 2);
             if (coordinates.length < 2) {
Index: trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandler.java	(revision 10115)
+++ trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandler.java	(revision 10116)
@@ -116,7 +116,7 @@
     @Override
     protected void validateRequest() throws RequestHandlerBadRequestException {
-        String url = args.get("url");
-        String type = args.get("type");
-        String cookies = args.get("cookies");
+        String url = args != null ? args.get("url") : null;
+        String type = args != null ? args.get("type") : null;
+        String cookies = args != null ? args.get("cookies") : null;
         try {
             ImageryLayer.create(new ImageryInfo(null, url, type, null, cookies));
Index: trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java	(revision 10115)
+++ trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java	(revision 10116)
@@ -269,8 +269,8 @@
         maxlon = 0;
         try {
-            minlat = LatLon.roundToOsmPrecision(Double.parseDouble(args.get("bottom")));
-            maxlat = LatLon.roundToOsmPrecision(Double.parseDouble(args.get("top")));
-            minlon = LatLon.roundToOsmPrecision(Double.parseDouble(args.get("left")));
-            maxlon = LatLon.roundToOsmPrecision(Double.parseDouble(args.get("right")));
+            minlat = LatLon.roundToOsmPrecision(Double.parseDouble(args != null ? args.get("bottom") : ""));
+            maxlat = LatLon.roundToOsmPrecision(Double.parseDouble(args != null ? args.get("top") : ""));
+            minlon = LatLon.roundToOsmPrecision(Double.parseDouble(args != null ? args.get("left") : ""));
+            maxlon = LatLon.roundToOsmPrecision(Double.parseDouble(args != null ? args.get("right") : ""));
         } catch (NumberFormatException e) {
             throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+')', e);
Index: trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadObjectHandler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadObjectHandler.java	(revision 10115)
+++ trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadObjectHandler.java	(revision 10116)
@@ -105,5 +105,5 @@
     protected void validateRequest() throws RequestHandlerBadRequestException {
         ps.clear();
-        for (String i : args.get("objects").split(",\\s*")) {
+        for (String i : (args != null ? args.get("objects") : "").split(",\\s*")) {
             try {
                 ps.add(SimplePrimitiveId.fromString(i));
Index: trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandlerTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandlerTest.java	(revision 10116)
+++ trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandlerTest.java	(revision 10116)
@@ -0,0 +1,104 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.io.remotecontrol.handler;
+
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.openstreetmap.josm.JOSMFixture;
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.osm.DataSet;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException;
+
+/**
+ * Unit tests of {@link AddWayHandler} class.
+ */
+public class AddWayHandlerTest {
+
+    /**
+     * Rule used for tests throwing exceptions.
+     */
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    /**
+     * Setup test.
+     */
+    @BeforeClass
+    public static void setUpBeforeClass() {
+        JOSMFixture.createUnitTestFixture().init(true);
+    }
+
+    private static AddWayHandler newHandler(String url) {
+        AddWayHandler req = new AddWayHandler();
+        if (url != null)
+            req.setUrl(url);
+        return req;
+    }
+
+    /**
+     * Unit test for bad request - no layer.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testBadRequestNoLayer() throws Exception {
+        thrown.expect(RequestHandlerBadRequestException.class);
+        thrown.expectMessage("There is no layer opened to add way");
+        newHandler("https://localhost?way=0,0;1,1").handle();
+    }
+
+    /**
+     * Unit test for bad request - no param.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testBadRequestNoParam() throws Exception {
+        thrown.expect(RequestHandlerBadRequestException.class);
+        thrown.expectMessage("Invalid coordinates: []");
+        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
+        try {
+            Main.main.addLayer(layer);
+            newHandler(null).handle();
+        } finally {
+            Main.main.removeLayer(layer);
+        }
+    }
+
+    /**
+     * Unit test for bad request - invalid URL.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testBadRequestInvalidUrl() throws Exception {
+        thrown.expect(RequestHandlerBadRequestException.class);
+        thrown.expectMessage("The following keys are mandatory, but have not been provided: way");
+        newHandler("invalid_url").handle();
+    }
+
+    /**
+     * Unit test for bad request - incomplete URL.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testBadRequestIncompleteUrl() throws Exception {
+        thrown.expect(RequestHandlerBadRequestException.class);
+        thrown.expectMessage("The following keys are mandatory, but have not been provided: way");
+        newHandler("https://localhost").handle();
+    }
+
+    /**
+     * Unit test for nominal request - local data file.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testNominalRequest() throws Exception {
+        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
+        try {
+            Main.main.addLayer(layer);
+            newHandler("https://localhost?way=0,0;1,1").handle();
+        } finally {
+            Main.main.removeLayer(layer);
+        }
+    }
+}
Index: trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandlerTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandlerTest.java	(revision 10116)
+++ trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandlerTest.java	(revision 10116)
@@ -0,0 +1,78 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.io.remotecontrol.handler;
+
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.openstreetmap.josm.JOSMFixture;
+import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException;
+
+/**
+ * Unit tests of {@link ImageryHandler} class.
+ */
+public class ImageryHandlerTest {
+
+    /**
+     * Rule used for tests throwing exceptions.
+     */
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    /**
+     * Setup test.
+     */
+    @BeforeClass
+    public static void setUpBeforeClass() {
+        JOSMFixture.createUnitTestFixture().init(true);
+    }
+
+    private static ImageryHandler newHandler(String url) {
+        ImageryHandler req = new ImageryHandler();
+        if (url != null)
+            req.setUrl(url);
+        return req;
+    }
+
+    /**
+     * Unit test for bad request - no param.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testBadRequestNoParam() throws Exception {
+        thrown.expect(RequestHandlerBadRequestException.class);
+        thrown.expectMessage("Parameter must not be null");
+        newHandler(null).handle();
+    }
+
+    /**
+     * Unit test for bad request - invalid URL.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testBadRequestInvalidUrl() throws Exception {
+        thrown.expect(RequestHandlerBadRequestException.class);
+        thrown.expectMessage("The following keys are mandatory, but have not been provided: url");
+        newHandler("invalid_url").handle();
+    }
+
+    /**
+     * Unit test for bad request - incomplete URL.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testBadRequestIncompleteUrl() throws Exception {
+        thrown.expect(RequestHandlerBadRequestException.class);
+        thrown.expectMessage("The following keys are mandatory, but have not been provided: url");
+        newHandler("https://localhost").handle();
+    }
+
+    /**
+     * Unit test for nominal request - local data file.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testNominalRequest() throws Exception {
+        newHandler("https://localhost?url=foo").handle();
+    }
+}
Index: trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandlerTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandlerTest.java	(revision 10116)
+++ trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandlerTest.java	(revision 10116)
@@ -0,0 +1,78 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.io.remotecontrol.handler;
+
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.openstreetmap.josm.JOSMFixture;
+import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException;
+
+/**
+ * Unit tests of {@link LoadAndZoomHandler} class.
+ */
+public class LoadAndZoomHandlerTest {
+
+    /**
+     * Rule used for tests throwing exceptions.
+     */
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    /**
+     * Setup test.
+     */
+    @BeforeClass
+    public static void setUpBeforeClass() {
+        JOSMFixture.createUnitTestFixture().init(true);
+    }
+
+    private static LoadAndZoomHandler newHandler(String url) {
+        LoadAndZoomHandler req = new LoadAndZoomHandler();
+        if (url != null)
+            req.setUrl(url);
+        return req;
+    }
+
+    /**
+     * Unit test for bad request - no param.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testBadRequestNoParam() throws Exception {
+        thrown.expect(RequestHandlerBadRequestException.class);
+        thrown.expectMessage("NumberFormatException (empty String)");
+        newHandler(null).handle();
+    }
+
+    /**
+     * Unit test for bad request - invalid URL.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testBadRequestInvalidUrl() throws Exception {
+        thrown.expect(RequestHandlerBadRequestException.class);
+        thrown.expectMessage("The following keys are mandatory, but have not been provided: bottom, top, left, right");
+        newHandler("invalid_url").handle();
+    }
+
+    /**
+     * Unit test for bad request - incomplete URL.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testBadRequestIncompleteUrl() throws Exception {
+        thrown.expect(RequestHandlerBadRequestException.class);
+        thrown.expectMessage("The following keys are mandatory, but have not been provided: bottom, top, left, right");
+        newHandler("https://localhost").handle();
+    }
+
+    /**
+     * Unit test for nominal request - local data file.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testNominalRequest() throws Exception {
+        newHandler("https://localhost?bottom=0&top=0&left=1&right=1").handle();
+    }
+}
Index: trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/LoadObjectHandlerTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/LoadObjectHandlerTest.java	(revision 10116)
+++ trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/LoadObjectHandlerTest.java	(revision 10116)
@@ -0,0 +1,76 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.io.remotecontrol.handler;
+
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.openstreetmap.josm.JOSMFixture;
+import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException;
+
+/**
+ * Unit tests of {@link LoadObjectHandler} class.
+ */
+public class LoadObjectHandlerTest {
+
+    /**
+     * Rule used for tests throwing exceptions.
+     */
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    /**
+     * Setup test.
+     */
+    @BeforeClass
+    public static void setUpBeforeClass() {
+        JOSMFixture.createUnitTestFixture().init(true);
+    }
+
+    private static LoadObjectHandler newHandler(String url) {
+        LoadObjectHandler req = new LoadObjectHandler();
+        if (url != null)
+            req.setUrl(url);
+        return req;
+    }
+
+    /**
+     * Unit test for bad request - no param.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testBadRequestNoParam() throws Exception {
+        newHandler(null).handle();
+    }
+
+    /**
+     * Unit test for bad request - invalid URL.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testBadRequestInvalidUrl() throws Exception {
+        thrown.expect(RequestHandlerBadRequestException.class);
+        thrown.expectMessage("The following keys are mandatory, but have not been provided: objects");
+        newHandler("invalid_url").handle();
+    }
+
+    /**
+     * Unit test for bad request - incomplete URL.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testBadRequestIncompleteUrl() throws Exception {
+        thrown.expect(RequestHandlerBadRequestException.class);
+        thrown.expectMessage("The following keys are mandatory, but have not been provided: objects");
+        newHandler("https://localhost").handle();
+    }
+
+    /**
+     * Unit test for nominal request - local data file.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testNominalRequest() throws Exception {
+        newHandler("https://localhost?objects=foo,bar").handle();
+    }
+}
