Index: /trunk/src/org/openstreetmap/josm/gui/download/BookmarkSelection.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/download/BookmarkSelection.java	(revision 9605)
+++ /trunk/src/org/openstreetmap/josm/gui/download/BookmarkSelection.java	(revision 9606)
@@ -105,5 +105,6 @@
     public void addGui(final DownloadDialog gui) {
         JPanel dlg = new JPanel(new GridBagLayout());
-        gui.addDownloadAreaSelector(dlg, tr("Bookmarks"));
+        if (gui != null)
+            gui.addDownloadAreaSelector(dlg, tr("Bookmarks"));
         GridBagConstraints gc = new GridBagConstraints();
 
@@ -113,5 +114,5 @@
             public void valueChanged(ListSelectionEvent e) {
                 Bookmark b = bookmarks.getSelectedValue();
-                if (b != null) {
+                if (b != null && gui != null) {
                     gui.boundingBoxChanged(b.getArea(), BookmarkSelection.this);
                 }
Index: /trunk/src/org/openstreetmap/josm/gui/download/BoundingBoxSelection.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/download/BoundingBoxSelection.java	(revision 9605)
+++ /trunk/src/org/openstreetmap/josm/gui/download/BoundingBoxSelection.java	(revision 9606)
@@ -121,5 +121,6 @@
         showUrl.addFocusListener(new SelectAllOnFocusHandler(showUrl));
 
-        gui.addDownloadAreaSelector(dlg, tr("Bounding Box"));
+        if (gui != null)
+            gui.addDownloadAreaSelector(dlg, tr("Bounding Box"));
         this.parent = gui;
     }
Index: /trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java	(revision 9605)
+++ /trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java	(revision 9606)
@@ -62,4 +62,8 @@
 import org.xml.sax.helpers.DefaultHandler;
 
+/**
+ * Place selector.
+ * @since 1329
+ */
 public class PlaceSelection implements DownloadSelection {
     private static final String HISTORY_KEY = "download.places.history";
@@ -145,5 +149,6 @@
         panel.add(scrollPane, BorderLayout.CENTER);
 
-        gui.addDownloadAreaSelector(panel, tr("Areas around places"));
+        if (gui != null)
+            gui.addDownloadAreaSelector(panel, tr("Areas around places"));
 
         scrollPane.setPreferredSize(scrollPane.getPreferredSize());
@@ -151,9 +156,11 @@
         tblSearchResults.getSelectionModel().addListSelectionListener(new ListSelectionHandler());
         tblSearchResults.addMouseListener(new MouseAdapter() {
-            @Override public void mouseClicked(MouseEvent e) {
+            @Override
+            public void mouseClicked(MouseEvent e) {
                 if (e.getClickCount() > 1) {
                     SearchResult sr = model.getSelectedSearchResult();
-                    if (sr == null) return;
-                    parent.startDownload(sr.getDownloadArea());
+                    if (sr != null) {
+                        parent.startDownload(sr.getDownloadArea());
+                    }
                 }
             }
@@ -410,12 +417,10 @@
         @Override
         public int getRowCount() {
-            if (data == null) return 0;
-            return data.size();
+            return data != null ? data.size() : 0;
         }
 
         @Override
         public Object getValueAt(int row, int column) {
-            if (data == null) return null;
-            return data.get(row);
+            return data != null ? data.get(row) : null;
         }
 
@@ -444,6 +449,11 @@
         private TableColumn col3;
         private TableColumn col4;
+
+        NamedResultTableColumnModel() {
+            createColumns();
+        }
+
         protected final void createColumns() {
-            TableColumn col = null;
+            TableColumn col;
             NamedResultCellRenderer renderer = new NamedResultCellRenderer();
 
@@ -485,8 +495,4 @@
             col4.setHeaderValue(fourth);
             fireColumnMarginChanged();
-        }
-
-        NamedResultTableColumnModel() {
-            createColumns();
         }
     }
@@ -555,5 +561,6 @@
             renderColor(isSelected);
 
-            if (value == null) return this;
+            if (value == null)
+                return this;
             SearchResult sr = (SearchResult) value;
             switch(column) {
Index: /trunk/src/org/openstreetmap/josm/gui/download/TileSelection.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/download/TileSelection.java	(revision 9605)
+++ /trunk/src/org/openstreetmap/josm/gui/download/TileSelection.java	(revision 9606)
@@ -37,5 +37,6 @@
     @Override
     public void addGui(final DownloadDialog gui) {
-        gui.addDownloadAreaSelector(chooser, tr("Tile Numbers"));
+        if (gui != null)
+            gui.addDownloadAreaSelector(chooser, tr("Tile Numbers"));
         parent = gui;
     }
Index: /trunk/test/unit/org/openstreetmap/josm/gui/download/BookmarkSelectionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/download/BookmarkSelectionTest.java	(revision 9606)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/download/BookmarkSelectionTest.java	(revision 9606)
@@ -0,0 +1,32 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.gui.download;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openstreetmap.josm.JOSMFixture;
+import org.openstreetmap.josm.data.Bounds;
+
+/**
+ * Unit tests of {@link BookmarkSelection} class.
+ */
+public class BookmarkSelectionTest {
+
+    /**
+     * Setup tests
+     */
+    @BeforeClass
+    public static void setUpBeforeClass() {
+        JOSMFixture.createUnitTestFixture().init();
+    }
+
+    /**
+     * Test for {@link BookmarkSelection#BookmarkSelection}.
+     */
+    @Test
+    public void testBookmarkSelection() {
+        BookmarkSelection sel = new BookmarkSelection();
+        sel.addGui(null);
+        sel.setDownloadArea(null);
+        sel.setDownloadArea(new Bounds(0, 0, 1, 1));
+    }
+}
Index: /trunk/test/unit/org/openstreetmap/josm/gui/download/BoundingBoxSelectionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/download/BoundingBoxSelectionTest.java	(revision 9606)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/download/BoundingBoxSelectionTest.java	(revision 9606)
@@ -0,0 +1,32 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.gui.download;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openstreetmap.josm.JOSMFixture;
+import org.openstreetmap.josm.data.Bounds;
+
+/**
+ * Unit tests of {@link BoundingBoxSelection} class.
+ */
+public class BoundingBoxSelectionTest {
+
+    /**
+     * Setup tests
+     */
+    @BeforeClass
+    public static void setUpBeforeClass() {
+        JOSMFixture.createUnitTestFixture().init();
+    }
+
+    /**
+     * Test for {@link BoundingBoxSelection#BoundingBoxSelection}.
+     */
+    @Test
+    public void testBoundingBoxSelection() {
+        BoundingBoxSelection sel = new BoundingBoxSelection();
+        sel.addGui(null);
+        sel.setDownloadArea(null);
+        sel.setDownloadArea(new Bounds(0, 0, 1, 1));
+    }
+}
Index: /trunk/test/unit/org/openstreetmap/josm/gui/download/PlaceSelectionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/download/PlaceSelectionTest.java	(revision 9606)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/download/PlaceSelectionTest.java	(revision 9606)
@@ -0,0 +1,32 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.gui.download;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openstreetmap.josm.JOSMFixture;
+import org.openstreetmap.josm.data.Bounds;
+
+/**
+ * Unit tests of {@link PlaceSelection} class.
+ */
+public class PlaceSelectionTest {
+
+    /**
+     * Setup tests
+     */
+    @BeforeClass
+    public static void setUpBeforeClass() {
+        JOSMFixture.createUnitTestFixture().init();
+    }
+
+    /**
+     * Test for {@link PlaceSelection#PlaceSelection}.
+     */
+    @Test
+    public void testBookmarkSelection() {
+        PlaceSelection sel = new PlaceSelection();
+        sel.addGui(null);
+        sel.setDownloadArea(null);
+        sel.setDownloadArea(new Bounds(0, 0, 1, 1));
+    }
+}
Index: /trunk/test/unit/org/openstreetmap/josm/gui/download/TileSelectionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/download/TileSelectionTest.java	(revision 9606)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/download/TileSelectionTest.java	(revision 9606)
@@ -0,0 +1,32 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.gui.download;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openstreetmap.josm.JOSMFixture;
+import org.openstreetmap.josm.data.Bounds;
+
+/**
+ * Unit tests of {@link TileSelection} class.
+ */
+public class TileSelectionTest {
+
+    /**
+     * Setup tests
+     */
+    @BeforeClass
+    public static void setUpBeforeClass() {
+        JOSMFixture.createUnitTestFixture().init();
+    }
+
+    /**
+     * Test for {@link TileSelection#TileSelection}.
+     */
+    @Test
+    public void testTileSelection() {
+        TileSelection sel = new TileSelection();
+        sel.addGui(null);
+        sel.setDownloadArea(null);
+        sel.setDownloadArea(new Bounds(0, 0, 1, 1));
+    }
+}
