Index: trunk/build.xml
===================================================================
--- trunk/build.xml	(revision 7039)
+++ trunk/build.xml	(revision 7040)
@@ -199,5 +199,5 @@
     	<!-- COTS -->
         <javac srcdir="src" includes="com/**,oauth/**,org/apache/commons/codec/**,org/glassfish/**" nowarn="on"
-        	destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" encoding="iso-8859-1">
+        	destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="iso-8859-1">
             <!-- get rid of "internal proprietary API" warning -->
         	<compilerarg value="-XDignore.symbol.file"/>
@@ -205,5 +205,5 @@
         <!-- JMapViewer/JOSM -->
         <javac srcdir="src" excludes="com/**,oauth/**,org/apache/commons/codec/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/Demo.java" 
-        	destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" encoding="UTF-8">
+        	destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
             <compilerarg value="-Xlint:cast"/>
             <compilerarg value="-Xlint:deprecation"/>
@@ -268,9 +268,16 @@
     </target>
     <target name="test-compile" depends="test-init,dist">
-        <javac srcdir="${test.dir}/unit" classpathref="test.classpath" destdir="${test.dir}/build" target="1.7" source="1.7" debug="on" includeantruntime="false" encoding="UTF-8">
+        <javac srcdir="${test.dir}/unit" classpathref="test.classpath" destdir="${test.dir}/build" target="1.7" source="1.7" debug="on"
+        	includeantruntime="false" createMissingPackageInfoClass="off" encoding="UTF-8">
             <compilerarg value="-Xlint:all"/>
             <compilerarg value="-Xlint:-serial"/>
         </javac>
-        <javac srcdir="${test.dir}/functional" classpathref="test.classpath" destdir="${test.dir}/build" target="1.7" source="1.7" debug="on" includeantruntime="false" encoding="UTF-8">
+        <javac srcdir="${test.dir}/functional" classpathref="test.classpath" destdir="${test.dir}/build" target="1.7" source="1.7" debug="on"
+        	includeantruntime="false" createMissingPackageInfoClass="off" encoding="UTF-8">
+            <compilerarg value="-Xlint:all"/>
+            <compilerarg value="-Xlint:-serial"/>
+        </javac>
+        <javac srcdir="${test.dir}/performance" classpathref="test.classpath" destdir="${test.dir}/build" target="1.7" source="1.7" debug="on"
+        	includeantruntime="false" createMissingPackageInfoClass="off" encoding="UTF-8">
             <compilerarg value="-Xlint:all"/>
             <compilerarg value="-Xlint:-serial"/>
Index: trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/LineClip.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/LineClip.java	(revision 7039)
+++ trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/LineClip.java	(revision 7040)
@@ -18,4 +18,10 @@
     private final Rectangle clipBounds;
 
+    /**
+     * Constructs a new {@code LineClip}.
+     * @param p1 start point of the clipped line
+     * @param p2 end point of the clipped line
+     * @param clipBounds Clip bounds
+     */
     public LineClip(Point p1, Point p2, Rectangle clipBounds) {
         this.p1 = p1;
@@ -29,4 +35,7 @@
      */
     public boolean execute() {
+        if (clipBounds == null) {
+            return false;
+        }
         return cohenSutherland(p1.x, p1.y, p2.x, p2.y, clipBounds.x , clipBounds.y, clipBounds.x + clipBounds.width, clipBounds.y + clipBounds.height);
     }
@@ -35,6 +44,5 @@
      * @return start point of the clipped line
      */
-    public Point getP1()
-    {
+    public Point getP1() {
         return p1;
     }
Index: trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java	(revision 7039)
+++ trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java	(revision 7040)
@@ -1175,5 +1175,8 @@
         GeneralPath onewayArrowsCasing = showOneway ? new GeneralPath() : null;
         Rectangle bounds = g.getClipBounds();
-        bounds.grow(100, 100);                  // avoid arrow heads at the border
+        if (bounds != null) {
+            // avoid arrow heads at the border
+            bounds.grow(100, 100);
+        }
 
         double wayLength = 0;
Index: trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java
===================================================================
--- trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java	(revision 7039)
+++ trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java	(revision 7040)
@@ -141,4 +141,7 @@
         //
         try (InputStream is = MultiFetchServerObjectReaderTest.class.getResourceAsStream("/test-functional-env.properties")) {
+            if (is == null) {
+                throw new IOException();
+            }
             testProperties.load(is);
         } catch(IOException e){
Index: trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java
===================================================================
--- trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java	(revision 7039)
+++ trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java	(revision 7040)
@@ -148,4 +148,7 @@
         //
         try (InputStream is = MultiFetchServerObjectReaderTest.class.getResourceAsStream("/test-functional-env.properties")) {
+            if (is == null) {
+                throw new IOException();
+            }
             testProperties.load(is);
         } catch(IOException e){
Index: trunk/test/functional/org/openstreetmap/josm/io/OsmServerHistoryReaderTest.java
===================================================================
--- trunk/test/functional/org/openstreetmap/josm/io/OsmServerHistoryReaderTest.java	(revision 7039)
+++ trunk/test/functional/org/openstreetmap/josm/io/OsmServerHistoryReaderTest.java	(revision 7040)
@@ -19,5 +19,5 @@
 
     @Test
-    public void test1()  throws OsmTransferException {
+    public void testNode()  throws OsmTransferException {
         OsmServerHistoryReader reader = new OsmServerHistoryReader(OsmPrimitiveType.NODE,266187);
         HistoryDataSet ds = reader.parseHistory(NullProgressMonitor.INSTANCE);
@@ -27,13 +27,13 @@
 
     @Test
-    public void test2()  throws OsmTransferException {
-        OsmServerHistoryReader reader = new OsmServerHistoryReader(OsmPrimitiveType.WAY,32916);
+    public void testWay()  throws OsmTransferException {
+        OsmServerHistoryReader reader = new OsmServerHistoryReader(OsmPrimitiveType.WAY,3058844);
         HistoryDataSet ds = reader.parseHistory(NullProgressMonitor.INSTANCE);
-        History h = ds.getHistory(32916, OsmPrimitiveType.WAY);
+        History h = ds.getHistory(3058844, OsmPrimitiveType.WAY);
         System.out.println("num versions: " + h.getNumVersions());
     }
 
     @Test
-    public void test3()  throws OsmTransferException {
+    public void testRelation()  throws OsmTransferException {
         OsmServerHistoryReader reader = new OsmServerHistoryReader(OsmPrimitiveType.RELATION,49);
         HistoryDataSet ds = reader.parseHistory(NullProgressMonitor.INSTANCE);
Index: trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/RemoteControlTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/RemoteControlTest.java	(revision 7040)
+++ trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/RemoteControlTest.java	(revision 7040)
@@ -0,0 +1,140 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.io.remotecontrol;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.GeneralSecurityException;
+import java.security.SecureRandom;
+import java.security.cert.X509Certificate;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSession;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.tools.Utils;
+
+/**
+ * Unit tests for Remote Control
+ */
+public class RemoteControlTest {
+
+    private String httpBase;
+    private String httpsBase;
+    
+    /**
+     * Starts Remote control before testing requests.
+     */
+    @Before
+    public void setUp() {
+        Main.initApplicationPreferences();
+        RemoteControl.start();
+        disableCertificateValidation();
+        httpBase = "http://127.0.0.1:"+Main.pref.getInteger("remote.control.port", 8111);
+        httpsBase = "https://127.0.0.1:"+Main.pref.getInteger("remote.control.https.port", 8112);
+    }
+    
+    /**
+     * Disable all HTTPS validation mechanisms as described 
+     * <a href="http://stackoverflow.com/a/2893932/2257172">here</a> and
+     * <a href="http://stackoverflow.com/a/19542614/2257172">here</a>
+     */
+    public void disableCertificateValidation() {
+        // Create a trust manager that does not validate certificate chains
+        TrustManager[] trustAllCerts = new TrustManager[] { 
+            new X509TrustManager() {
+                public X509Certificate[] getAcceptedIssuers() {
+                    return null;
+                }
+                public void checkClientTrusted(X509Certificate[] certs, String authType) {
+                }
+                public void checkServerTrusted(X509Certificate[] certs, String authType) {
+                }
+            }
+        };
+
+        // Install the all-trusting trust manager
+        try {
+            SSLContext sc = SSLContext.getInstance("TLS");
+            sc.init(null, trustAllCerts, new SecureRandom());
+            HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
+        } catch (GeneralSecurityException e) {
+            fail(e.getMessage());
+        }
+        
+        // Create all-trusting host name verifier
+        HostnameVerifier allHostsValid = new HostnameVerifier() {
+            @Override
+            public boolean verify(String hostname, SSLSession session) {
+                return true;
+            }
+        };
+
+        // Install the all-trusting host verifier
+        HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
+    }
+
+    /**
+     * Stops Remote control after testing requests.
+     */
+    @After
+    public void tearDown() {
+        RemoteControl.stop();
+    }
+
+    /**
+     * Tests that sending an HTTP request without command results in HTTP 400, with all available commands in error message.
+     * @throws IOException if an I/O error occurs
+     * @throws MalformedURLException if HTTP URL is invalid  
+     */
+    @Test
+    public void testHttpListOfCommands() throws MalformedURLException, IOException {
+        testListOfCommands(httpBase);
+    }
+
+    /**
+     * Tests that sending an HTTPS request without command results in HTTP 400, with all available commands in error message.
+     * @throws IOException if an I/O error occurs
+     * @throws MalformedURLException if HTTPS URL is invalid  
+     */
+    @Test
+    public void testHttpsListOfCommands() throws MalformedURLException, IOException {
+        testListOfCommands(httpsBase);
+    }
+
+    private void testListOfCommands(String url) throws MalformedURLException, IOException {
+        HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
+        connection.connect();
+        assertEquals(connection.getResponseCode(), HttpURLConnection.HTTP_BAD_REQUEST);
+        try (InputStream is = connection.getErrorStream()) {
+            // TODO this code should be refactored somewhere in Utils as it is used in several JOSM classes 
+            StringBuilder responseBody = new StringBuilder();
+            try (BufferedReader in = new BufferedReader(new InputStreamReader(is, Utils.UTF_8))) {
+                String s;
+                while((s = in.readLine()) != null) {
+                    responseBody.append(s);
+                    responseBody.append("\n");
+                }
+            }
+            assert responseBody.toString().contains(RequestProcessor.getUsageAsHtml());
+        } catch (IllegalAccessException e) {
+            fail(e.getMessage());
+        } catch (InstantiationException e) {
+            fail(e.getMessage());
+        }
+    }
+}
