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) {
