Index: trunk/src/org/openstreetmap/josm/actions/ExpertToggleAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/ExpertToggleAction.java	(revision 9610)
+++ trunk/src/org/openstreetmap/josm/actions/ExpertToggleAction.java	(revision 9611)
@@ -124,5 +124,7 @@
         );
         putValue("toolbar", "expertmode");
-        Main.toolbar.register(this);
+        if (Main.toolbar != null) {
+            Main.toolbar.register(this);
+        }
         setSelected(Main.pref.getBoolean("expert", false));
         notifySelectedState();
Index: trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreference.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreference.java	(revision 9610)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreference.java	(revision 9611)
@@ -74,4 +74,15 @@
     }
 
+    private JosmTextField tfFilter;
+    private PluginListPanel pnlPluginPreferences;
+    private PluginPreferencesModel model;
+    private JScrollPane spPluginPreferences;
+    private PluginUpdatePolicyPanel pnlPluginUpdatePolicy;
+
+    /**
+     * is set to true if this preference pane has been selected by the user
+     */
+    private boolean pluginPreferencesActivated;
+
     private PluginPreference() {
         super(/* ICON(preferences/) */ "plugin", tr("Plugins"), tr("Configure available plugins."), false, new JTabbedPane());
@@ -146,18 +157,6 @@
     }
 
-    private JosmTextField tfFilter;
-    private PluginListPanel pnlPluginPreferences;
-    private PluginPreferencesModel model;
-    private JScrollPane spPluginPreferences;
-    private PluginUpdatePolicyPanel pnlPluginUpdatePolicy;
-
-    /**
-     * is set to true if this preference pane has been selected
-     * by the user
-     */
-    private boolean pluginPreferencesActivated;
-
     protected JPanel buildSearchFieldPanel() {
-        JPanel pnl  = new JPanel(new GridBagLayout());
+        JPanel pnl = new JPanel(new GridBagLayout());
         pnl.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
         GridBagConstraints gc = new GridBagConstraints();
@@ -268,7 +267,7 @@
 
     /**
-     * Replies the list of plugins waiting for update or download
+     * Replies the set of plugins waiting for update or download
      *
-     * @return the list of plugins waiting for update or download
+     * @return the set of plugins waiting for update or download
      */
     public Set<PluginInformation> getPluginsScheduledForUpdateOrDownload() {
@@ -276,4 +275,9 @@
     }
 
+    /**
+     * Replies the list of plugins which have been added by the user to the set of activated plugins
+     *
+     * @return the list of newly activated plugins
+     */
     public List<PluginInformation> getNewlyActivatedPlugins() {
         return model != null ? model.getNewlyActivatedPlugins() : null;
@@ -289,7 +293,9 @@
             Collections.sort(l);
             Main.pref.putCollection("plugins", l);
-            if (!model.getNewlyDeactivatedPlugins().isEmpty()) return true;
+            if (!model.getNewlyDeactivatedPlugins().isEmpty())
+                return true;
             for (PluginInformation pi : model.getNewlyActivatedPlugins()) {
-                if (!pi.canloadatruntime) return true;
+                if (!pi.canloadatruntime)
+                    return true;
             }
         }
@@ -308,12 +314,13 @@
             @Override
             public void run() {
-                if (task.isCanceled()) return;
-                SwingUtilities.invokeLater(new Runnable() {
-                    @Override
-                    public void run() {
-                        model.setAvailablePlugins(task.getAvailablePlugins());
-                        pnlPluginPreferences.refreshView();
-                    }
-                });
+                if (!task.isCanceled()) {
+                    SwingUtilities.invokeLater(new Runnable() {
+                        @Override
+                        public void run() {
+                            model.setAvailablePlugins(task.getAvailablePlugins());
+                            pnlPluginPreferences.refreshView();
+                        }
+                    });
+                }
             }
         };
@@ -346,13 +353,14 @@
                 @Override
                 public void run() {
-                    if (task.isCanceled()) return;
-                    SwingUtilities.invokeLater(new Runnable() {
-                        @Override
-                        public void run() {
-                            model.updateAvailablePlugins(task.getAvailablePlugins());
-                            pnlPluginPreferences.refreshView();
-                            Main.pref.putInteger("pluginmanager.version", Version.getInstance().getVersion()); // fix #7030
-                        }
-                    });
+                    if (!task.isCanceled()) {
+                        SwingUtilities.invokeLater(new Runnable() {
+                            @Override
+                            public void run() {
+                                model.updateAvailablePlugins(task.getAvailablePlugins());
+                                pnlPluginPreferences.refreshView();
+                                Main.pref.putInteger("pluginmanager.version", Version.getInstance().getVersion()); // fix #7030
+                            }
+                        });
+                    }
                 }
             };
@@ -512,10 +520,9 @@
     private static class PluginConfigurationSitesPanel extends JPanel {
 
-        private DefaultListModel<String> model;
-
-        protected final void build() {
-            setLayout(new GridBagLayout());
+        private final DefaultListModel<String> model = new DefaultListModel<>();
+
+        PluginConfigurationSitesPanel() {
+            super(new GridBagLayout());
             add(new JLabel(tr("Add JOSM Plugin description URL.")), GBC.eol());
-            model = new DefaultListModel<>();
             for (String s : Main.pref.getPluginSites()) {
                 model.addElement(s);
@@ -582,10 +589,7 @@
         }
 
-        PluginConfigurationSitesPanel() {
-            build();
-        }
-
         public List<String> getUpdateSites() {
-            if (model.getSize() == 0) return Collections.emptyList();
+            if (model.getSize() == 0)
+                return Collections.emptyList();
             List<String> ret = new ArrayList<>(model.getSize());
             for (int i = 0; i < model.getSize(); i++) {
Index: trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferencesModel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferencesModel.java	(revision 9610)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferencesModel.java	(revision 9611)
@@ -83,8 +83,6 @@
         activePlugins.addAll(Main.pref.getCollection("plugins", activePlugins));
         for (PluginInformation pi: availablePlugins) {
-            if (selectedPluginsMap.get(pi) == null) {
-                if (activePlugins.contains(pi.name)) {
-                    selectedPluginsMap.put(pi, Boolean.TRUE);
-                }
+            if (selectedPluginsMap.get(pi) == null && activePlugins.contains(pi.name)) {
+                selectedPluginsMap.put(pi, Boolean.TRUE);
             }
         }
@@ -94,11 +92,12 @@
 
     protected void updateAvailablePlugin(PluginInformation other) {
-        if (other == null) return;
-        PluginInformation pi = getPluginInformation(other.name);
-        if (pi == null) {
-            availablePlugins.add(other);
-            return;
-        }
-        pi.updateFromPluginSite(other);
+        if (other != null) {
+            PluginInformation pi = getPluginInformation(other.name);
+            if (pi == null) {
+                availablePlugins.add(other);
+                return;
+            }
+            pi.updateFromPluginSite(other);
+        }
     }
 
@@ -216,7 +215,8 @@
      */
     public void clearPendingPlugins(Collection<PluginInformation> plugins) {
-        if (plugins == null || plugins.isEmpty()) return;
-        for (PluginInformation pi: plugins) {
-            pendingDownloads.remove(pi.name);
+        if (plugins != null) {
+            for (PluginInformation pi: plugins) {
+                pendingDownloads.remove(pi.name);
+            }
         }
     }
@@ -264,6 +264,6 @@
     public boolean isSelectedPlugin(String name) {
         PluginInformation pi = getPluginInformation(name);
-        if (pi == null) return false;
-        if (selectedPluginsMap.get(pi) == null) return false;
+        if (pi == null || selectedPluginsMap.get(pi) == null)
+            return false;
         return selectedPluginsMap.get(pi);
     }
@@ -273,5 +273,5 @@
      * the set of activated plugins.
      *
-     * @return the set of newly deactivated plugins
+     * @return the set of newly activated plugins
      */
     public List<PluginInformation> getNewlyActivatedPlugins() {
@@ -289,5 +289,5 @@
     /**
      * Replies the set of plugins which have been removed by the user from
-     * the set of activated plugins.
+     * the set of deactivated plugins.
      *
      * @return the set of newly deactivated plugins
@@ -349,20 +349,19 @@
      */
     public void refreshLocalPluginVersion(Collection<PluginInformation> plugins) {
-        if (plugins == null) return;
-        for (PluginInformation pi : plugins) {
-            File downloadedPluginFile = PluginHandler.findUpdatedJar(pi.name);
-            if (downloadedPluginFile == null) {
-                continue;
-            }
-            try {
-                PluginInformation newinfo = new PluginInformation(downloadedPluginFile, pi.name);
-                PluginInformation oldinfo = getPluginInformation(pi.name);
-                if (oldinfo == null) {
-                    // should not happen
+        if (plugins != null) {
+            for (PluginInformation pi : plugins) {
+                File downloadedPluginFile = PluginHandler.findUpdatedJar(pi.name);
+                if (downloadedPluginFile == null) {
                     continue;
                 }
-                oldinfo.updateLocalInfo(newinfo);
-            } catch (PluginException e) {
-                Main.error(e);
+                try {
+                    PluginInformation newinfo = new PluginInformation(downloadedPluginFile, pi.name);
+                    PluginInformation oldinfo = getPluginInformation(pi.name);
+                    if (oldinfo != null) {
+                        oldinfo.updateLocalInfo(newinfo);
+                    }
+                } catch (PluginException e) {
+                    Main.error(e);
+                }
             }
         }
Index: trunk/test/unit/org/openstreetmap/josm/actions/mapmode/MapViewMock.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/actions/mapmode/MapViewMock.java	(revision 9610)
+++ trunk/test/unit/org/openstreetmap/josm/actions/mapmode/MapViewMock.java	(revision 9611)
@@ -52,5 +52,5 @@
     @Override
     public Point2D getPoint2D(EastNorth p) {
-        return new Point2D.Double(p.getX(), p.getY());
+        return p != null ? new Point2D.Double(p.getX(), p.getY()) : null;
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/gui/dialogs/ConflictDialogTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/dialogs/ConflictDialogTest.java	(revision 9610)
+++ trunk/test/unit/org/openstreetmap/josm/gui/dialogs/ConflictDialogTest.java	(revision 9611)
@@ -12,4 +12,5 @@
 import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.Relation;
@@ -54,5 +55,7 @@
         ConflictPainter cp = new ConflictPainter(Main.map.mapView, new BufferedImage(800, 600, BufferedImage.TYPE_3BYTE_BGR).createGraphics());
         Node n1 = new Node(1, 1);
+        n1.setCoor(new LatLon(1, 1));
         Node n2 = new Node(2, 1);
+        n2.setCoor(new LatLon(2, 2));
         Way w = new Way(1, 1);
         w.addNode(n1);
Index: trunk/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceTest.java	(revision 9610)
+++ trunk/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceTest.java	(revision 9611)
@@ -2,9 +2,20 @@
 package org.openstreetmap.josm.gui.preferences.plugin;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
 
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.openstreetmap.josm.JOSMFixture;
+import org.openstreetmap.josm.TestUtils;
+import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane;
+import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
+import org.openstreetmap.josm.plugins.PluginDownloadTask;
+import org.openstreetmap.josm.plugins.PluginInformation;
 
 /**
@@ -28,3 +39,49 @@
         assertNotNull(new PluginPreference.Factory().createPreferenceSetting());
     }
+
+    /**
+     * Unit test of {@link PluginPreference#buildDownloadSummary}.
+     * @throws Exception if an error occurs
+     */
+    @Test
+    public void testBuildDownloadSummary() throws Exception  {
+        final PluginInformation dummy = new PluginInformation(
+                new File(TestUtils.getTestDataRoot() + "plugin/dummy_plugin.jar"), "dummy_plugin");
+        assertEquals("", PluginPreference.buildDownloadSummary(
+                new PluginDownloadTask(NullProgressMonitor.INSTANCE, Collections.<PluginInformation>emptyList(), "")));
+        assertEquals("", PluginPreference.buildDownloadSummary(
+                new PluginDownloadTask(NullProgressMonitor.INSTANCE, Arrays.asList(dummy), "")));
+        assertEquals("The following plugin has been downloaded <strong>successfully</strong>:<ul><li>dummy_plugin (31772)</li></ul>"+
+                     "Downloading the following plugin has <strong>failed</strong>:<ul><li>dummy_plugin</li></ul>",
+                PluginPreference.buildDownloadSummary(
+                        new PluginDownloadTask(NullProgressMonitor.INSTANCE, Arrays.asList(dummy), "") {
+                    @Override
+                    public Collection<PluginInformation> getFailedPlugins() {
+                        return Collections.singleton(dummy);
+                    }
+
+                    @Override
+                    public Collection<PluginInformation> getDownloadedPlugins() {
+                        return Collections.singleton(dummy);
+                    }
+                }));
+    }
+
+    /**
+     * Unit test of {@link PluginPreference#notifyDownloadResults}.
+     */
+    @Test
+    public void testNotifyDownloadResults() {
+        PluginDownloadTask task = new PluginDownloadTask(NullProgressMonitor.INSTANCE, Collections.<PluginInformation>emptyList(), "");
+        PluginPreference.notifyDownloadResults(null, task, false);
+        PluginPreference.notifyDownloadResults(null, task, true);
+    }
+
+    /**
+     * Unit test of {@link PluginPreference#addGui}.
+     */
+    @Test
+    public void testAddGui() {
+        new PluginPreference.Factory().createPreferenceSetting().addGui(new PreferenceTabbedPane());
+    }
 }
