Index: trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java	(revision 10972)
+++ trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java	(revision 10973)
@@ -146,10 +146,8 @@
          */
         PermissionPrefWithDefault permissionPref = getPermissionPref();
-        if (permissionPref != null && permissionPref.pref != null) {
-            if (!Main.pref.getBoolean(permissionPref.pref, permissionPref.defaultVal)) {
-                String err = MessageFormat.format("RemoteControl: ''{0}'' forbidden by preferences", myCommand);
-                Main.info(err);
-                throw new RequestHandlerForbiddenException(err);
-            }
+        if (permissionPref != null && permissionPref.pref != null && !Main.pref.getBoolean(permissionPref.pref, permissionPref.defaultVal)) {
+            String err = MessageFormat.format("RemoteControl: ''{0}'' forbidden by preferences", myCommand);
+            Main.info(err);
+            throw new RequestHandlerForbiddenException(err);
         }
 
@@ -179,8 +177,13 @@
      *
      * @param url The request URL.
-     */
-    public void setUrl(String url) {
+     * @throws RequestHandlerBadRequestException if request URL is invalid
+     */
+    public void setUrl(String url) throws RequestHandlerBadRequestException {
         this.request = url;
-        parseArgs();
+        try {
+            parseArgs();
+        } catch (URISyntaxException e) {
+            throw new RequestHandlerBadRequestException(e);
+        }
     }
 
@@ -190,11 +193,8 @@
      *
      * Can be overridden by subclass.
-     */
-    protected void parseArgs() {
-        try {
-            this.args = getRequestParameter(new URI(this.request));
-        } catch (URISyntaxException ex) {
-            throw new RuntimeException(ex);
-        }
+     * @throws URISyntaxException if request URL is invalid
+     */
+    protected void parseArgs() throws URISyntaxException {
+        this.args = getRequestParameter(new URI(this.request));
     }
 
@@ -311,4 +311,9 @@
 
     public static class RequestHandlerErrorException extends RequestHandlerException {
+
+        /**
+         * Constructs a new {@code RequestHandlerErrorException}.
+         * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method).
+         */
         public RequestHandlerErrorException(Throwable cause) {
             super(cause);
@@ -318,8 +323,25 @@
     public static class RequestHandlerBadRequestException extends RequestHandlerException {
 
+        /**
+         * Constructs a new {@code RequestHandlerBadRequestException}.
+         * @param message the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method.
+         */
         public RequestHandlerBadRequestException(String message) {
             super(message);
         }
 
+        /**
+         * Constructs a new {@code RequestHandlerBadRequestException}.
+         * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method).
+         */
+        public RequestHandlerBadRequestException(Throwable cause) {
+            super(cause);
+        }
+
+        /**
+         * Constructs a new {@code RequestHandlerBadRequestException}.
+         * @param message the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method.
+         * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method).
+         */
         public RequestHandlerBadRequestException(String message, Throwable cause) {
             super(message, cause);
@@ -328,6 +350,9 @@
 
     public static class RequestHandlerForbiddenException extends RequestHandlerException {
-        private static final long serialVersionUID = 2263904699747115423L;
-
+
+        /**
+         * Constructs a new {@code RequestHandlerForbiddenException}.
+         * @param message the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method.
+         */
         public RequestHandlerForbiddenException(String message) {
             super(message);
@@ -337,5 +362,5 @@
     public abstract static class RawURLParseRequestHandler extends RequestHandler {
         @Override
-        protected void parseArgs() {
+        protected void parseArgs() throws URISyntaxException {
             Map<String, String> args = new HashMap<>();
             if (request.indexOf('?') != -1) {
Index: trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandlerTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandlerTest.java	(revision 10972)
+++ trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandlerTest.java	(revision 10973)
@@ -31,5 +31,5 @@
     }
 
-    private static AddNodeHandler newHandler(String url) {
+    private static AddNodeHandler newHandler(String url) throws RequestHandlerBadRequestException {
         AddNodeHandler req = new AddNodeHandler();
         if (url != null)
Index: trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandlerTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandlerTest.java	(revision 10972)
+++ trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandlerTest.java	(revision 10973)
@@ -31,5 +31,5 @@
     }
 
-    private static AddWayHandler newHandler(String url) {
+    private static AddWayHandler newHandler(String url) throws RequestHandlerBadRequestException {
         AddWayHandler req = new AddWayHandler();
         if (url != null)
Index: trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandlerTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandlerTest.java	(revision 10972)
+++ trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandlerTest.java	(revision 10973)
@@ -28,5 +28,5 @@
     }
 
-    private static ImageryHandler newHandler(String url) {
+    private static ImageryHandler newHandler(String url) throws RequestHandlerBadRequestException {
         ImageryHandler req = new ImageryHandler();
         if (url != null)
Index: trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandlerTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandlerTest.java	(revision 10972)
+++ trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandlerTest.java	(revision 10973)
@@ -36,5 +36,5 @@
     }
 
-    private static ImportHandler newHandler(String url) {
+    private static ImportHandler newHandler(String url) throws RequestHandlerBadRequestException {
         ImportHandler req = new ImportHandler();
         if (url != null)
@@ -45,7 +45,8 @@
     /**
      * Non-regression test for bug #7434.
+     * @throws Exception if any error occurs
      */
     @Test
-    public void testTicket7434() {
+    public void testTicket7434() throws Exception {
         ImportHandler req = newHandler("http://localhost:8111/import?url=http://localhost:8888/relations?relations=19711&mode=recursive");
         assertEquals("http://localhost:8888/relations?relations=19711&mode=recursive", req.args.get("url"));
Index: trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandlerTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandlerTest.java	(revision 10972)
+++ trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandlerTest.java	(revision 10973)
@@ -28,5 +28,5 @@
     }
 
-    private static LoadAndZoomHandler newHandler(String url) {
+    private static LoadAndZoomHandler newHandler(String url) throws RequestHandlerBadRequestException {
         LoadAndZoomHandler req = new LoadAndZoomHandler();
         if (url != null)
Index: trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/LoadObjectHandlerTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/LoadObjectHandlerTest.java	(revision 10972)
+++ trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/LoadObjectHandlerTest.java	(revision 10973)
@@ -28,5 +28,5 @@
     }
 
-    private static LoadObjectHandler newHandler(String url) {
+    private static LoadObjectHandler newHandler(String url) throws RequestHandlerBadRequestException {
         LoadObjectHandler req = new LoadObjectHandler();
         if (url != null)
Index: trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandlerTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandlerTest.java	(revision 10972)
+++ trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandlerTest.java	(revision 10973)
@@ -10,4 +10,5 @@
 import org.junit.Test;
 import org.openstreetmap.josm.io.remotecontrol.PermissionPrefWithDefault;
+import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException;
 
 /**
@@ -16,5 +17,5 @@
 public class RequestHandlerTest {
 
-    Map<String, String> getRequestParameter(String url) {
+    Map<String, String> getRequestParameter(String url) throws RequestHandlerBadRequestException {
         final RequestHandler req = new RequestHandler() {
             @Override
@@ -47,7 +48,8 @@
     /**
      * Test request parameter - case 1
+     * @throws RequestHandlerBadRequestException never
      */
     @Test
-    public void testRequestParameter1() {
+    public void testRequestParameter1() throws RequestHandlerBadRequestException {
         final Map<String, String> expected = new HashMap<>();
         expected.put("query", "a");
@@ -58,7 +60,8 @@
     /**
      * Test request parameter - case 2
+     * @throws RequestHandlerBadRequestException never
      */
     @Test
-    public void testRequestParameter2() {
+    public void testRequestParameter2() throws RequestHandlerBadRequestException {
         assertEquals(Collections.singletonMap("query", "a&b==c"),
                 getRequestParameter("http://example.com/?query=a%26b==c"));
@@ -67,7 +70,8 @@
     /**
      * Test request parameter - case 3
+     * @throws RequestHandlerBadRequestException never
      */
     @Test
-    public void testRequestParameter3() {
+    public void testRequestParameter3() throws RequestHandlerBadRequestException {
         assertEquals(Collections.singleton("blue+light blue"),
                 getRequestParameter("http://example.com/blue+light%20blue?blue%2Blight+blue").keySet());
@@ -78,7 +82,8 @@
      * @see <a href="http://blog.lunatech.com/2009/02/03/what-every-web-developer-must-know-about-url-encoding">
      *      What every web developer must know about URL encoding</a>
+     * @throws RequestHandlerBadRequestException never
      */
     @Test
-    public void testRequestParameter4() {
+    public void testRequestParameter4() throws RequestHandlerBadRequestException {
         assertEquals(Collections.singletonMap("/?:@-._~!$'()* ,;", "/?:@-._~!$'()* ,;=="), getRequestParameter(
                 // CHECKSTYLE.OFF: LineLength
@@ -89,7 +94,8 @@
     /**
      * Test request parameter - case 5
+     * @throws RequestHandlerBadRequestException never
      */
     @Test
-    public void testRequestParameter5() {
+    public void testRequestParameter5() throws RequestHandlerBadRequestException {
         final Map<String, String> expected = new HashMap<>();
         expected.put("space", " ");
@@ -97,3 +103,15 @@
         assertEquals(expected, getRequestParameter("http://example.com/?space=%20&tab=%09"));
     }
+
+    /**
+     * Test request parameter - invalid case
+     * @throws RequestHandlerBadRequestException always
+     */
+    @Test(expected = RequestHandlerBadRequestException.class)
+    public void testRequestParameterInvalid() throws RequestHandlerBadRequestException {
+        getRequestParameter("http://localhost:8111/load_and_zoom"+
+                "?addtags=wikipedia:de=Wei%C3%9Fe_Gasse|maxspeed=5"+
+                "&select=way23071688,way23076176,way23076177,"+
+                "&left=13.739727546842&right=13.740890970188&top=51.049987191025&bottom=51.048466954325");
+    }
 }
