Index: trunk/src/org/openstreetmap/josm/gui/preferences/PluginPreference.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/PluginPreference.java	(revision 5721)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/PluginPreference.java	(revision 5723)
@@ -45,4 +45,5 @@
 import org.openstreetmap.josm.gui.preferences.plugin.PluginPreferencesModel;
 import org.openstreetmap.josm.gui.preferences.plugin.PluginUpdatePolicyPanel;
+import org.openstreetmap.josm.gui.util.GuiHelper;
 import org.openstreetmap.josm.gui.widgets.SelectAllOnFocusGainedDecorator;
 import org.openstreetmap.josm.plugins.PluginDownloadTask;
@@ -303,7 +304,7 @@
 
         protected void notifyDownloadResults(PluginDownloadTask task) {
-            Collection<PluginInformation> downloaded = task.getDownloadedPlugins();
-            Collection<PluginInformation> failed = task.getFailedPlugins();
-            StringBuilder sb = new StringBuilder();
+            final Collection<PluginInformation> downloaded = task.getDownloadedPlugins();
+            final Collection<PluginInformation> failed = task.getFailedPlugins();
+            final StringBuilder sb = new StringBuilder();
             sb.append("<html>");
             sb.append(buildDownloadSummary(task));
@@ -312,11 +313,16 @@
             }
             sb.append("</html>");
-            HelpAwareOptionPane.showOptionDialog(
-                    pnlPluginPreferences,
-                    sb.toString(),
-                    tr("Update plugins"),
-                    !failed.isEmpty() ? JOptionPane.WARNING_MESSAGE : JOptionPane.INFORMATION_MESSAGE,
-                            HelpUtil.ht("/Preferences/Plugins")
-                    );
+            GuiHelper.runInEDTAndWait(new Runnable() {
+                @Override
+                public void run() {
+                    HelpAwareOptionPane.showOptionDialog(
+                            pnlPluginPreferences,
+                            sb.toString(),
+                            tr("Update plugins"),
+                            !failed.isEmpty() ? JOptionPane.WARNING_MESSAGE : JOptionPane.INFORMATION_MESSAGE,
+                                    HelpUtil.ht("/Preferences/Plugins")
+                            );
+                }
+            });
         }
 
@@ -359,5 +365,9 @@
                     model.refreshLocalPluginVersion(pluginDownloadTask.getDownloadedPlugins());
                     model.clearPendingPlugins(pluginDownloadTask.getDownloadedPlugins());
-                    pnlPluginPreferences.refreshView();
+                    GuiHelper.runInEDT(new Runnable() {
+                        @Override
+                        public void run() {
+                            pnlPluginPreferences.refreshView();                        }
+                    });
                 }
             };
Index: trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java	(revision 5721)
+++ trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java	(revision 5723)
@@ -34,4 +34,5 @@
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
+import java.util.jar.JarFile;
 
 import javax.swing.AbstractAction;
@@ -509,6 +510,11 @@
             }
             msg = null;
-        } catch(PluginException e) {
-            e.printStackTrace();
+        } catch (PluginException e) {
+            System.err.print(e.getMessage());
+            Throwable cause = e.getCause();
+            if (cause != null) {
+                System.err.print(". " + cause.getClass().getName() + ": " + cause.getLocalizedMessage());
+            }
+            System.err.println();
             if (e.getCause() instanceof ClassNotFoundException) {
                 msg = tr("<html>Could not load plugin {0} because the plugin<br>main class ''{1}'' was not found.<br>"
@@ -974,4 +980,14 @@
                 }
             }
+            try {
+                // Check the plugin is a valid and accessible JAR file before installing it (fix #7754)
+                new JarFile(updatedPlugin).close();
+            } catch (Exception e) {
+                if (dowarn) {
+                    System.err.println(tr("Warning: failed to install plugin ''{0}'' from temporary download file ''{1}''. {2}", plugin.toString(), updatedPlugin.toString(), e.getLocalizedMessage()));
+                }
+                continue;
+            }
+            // Install plugin
             if (!updatedPlugin.renameTo(plugin) && dowarn) {
                 System.err.println(tr("Warning: failed to install plugin ''{0}'' from temporary download file ''{1}''. Renaming failed.", plugin.toString(), updatedPlugin.toString()));
@@ -980,4 +996,22 @@
         }
         return;
+    }
+    
+    /**
+     * Determines if the specified file is a valid and accessible JAR file.
+     * @param jar The fil to check
+     * @return true if file can be opened as a JAR file.
+     * @since 5723
+     */
+    public static boolean isValidJar(File jar) {
+        if (jar != null && jar.exists() && jar.canRead()) {
+            try {
+                new JarFile(jar).close();
+            } catch (Exception e) {
+                return false;
+            }
+            return true;
+        }
+        return false;
     }
     
@@ -991,10 +1025,9 @@
         File pluginDir = Main.pref.getPluginsDirectory();
         // Find the downloaded file. We have tried to install the downloaded plugins
-        // (PluginHandler.installDownloadedPlugins). This succeeds depending on the
-        // platform.
+        // (PluginHandler.installDownloadedPlugins). This succeeds depending on the platform.
         File downloadedPluginFile = new File(pluginDir, name + ".jar.new");
-        if (!(downloadedPluginFile.exists() && downloadedPluginFile.canRead())) {
+        if (!isValidJar(downloadedPluginFile)) {
             downloadedPluginFile = new File(pluginDir, name + ".jar");
-            if (!(downloadedPluginFile.exists() && downloadedPluginFile.canRead())) {
+            if (!isValidJar(downloadedPluginFile)) {
                 return null;
             }
Index: trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java
===================================================================
--- trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java	(revision 5721)
+++ trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java	(revision 5723)
@@ -75,5 +75,5 @@
     /**
      * Creates a plugin information object for the plugin with name {@code name}.
-     * Information about the plugin is extracted from the maifest file in the plugin jar
+     * Information about the plugin is extracted from the manifest file in the plugin jar
      * {@code file}.
      * @param file the plugin jar
@@ -81,5 +81,8 @@
      * @throws PluginException thrown if reading the manifest file fails
      */
-    public PluginInformation(File file, String name) throws PluginException{
+    public PluginInformation(File file, String name) throws PluginException {
+        if (!PluginHandler.isValidJar(file)) {
+            throw new PluginException(name, tr("Invalid jar file ''{0}''", file));
+        }
         this.name = name;
         this.file = file;
@@ -324,5 +327,5 @@
         } catch (ClassNotFoundException e) {
             throw new PluginException(name, e);
-        } catch(ClassCastException e) {
+        } catch (ClassCastException e) {
             throw new PluginException(name, e);
         }
Index: trunk/src/org/openstreetmap/josm/plugins/ReadLocalPluginInformationTask.java
===================================================================
--- trunk/src/org/openstreetmap/josm/plugins/ReadLocalPluginInformationTask.java	(revision 5721)
+++ trunk/src/org/openstreetmap/josm/plugins/ReadLocalPluginInformationTask.java	(revision 5723)
@@ -28,6 +28,6 @@
  * and extracts plugin information from three kind of files:
  * <ul>
- *   <li>.jar-files, assuming that they represent plugin jars</li>
- *   <li>.jar.new-files, assuming that these are downloaded but not yet installed plugins</li>
+ *   <li>.jar files, assuming that they represent plugin jars</li>
+ *   <li>.jar.new files, assuming that these are downloaded but not yet installed plugins</li>
  *   <li>cached lists of available plugins, downloaded for instance from
  *   <a href="http://josm.openstreetmap.de/plugins">http://josm.openstreetmap.de/plugins</a></li>
@@ -147,7 +147,7 @@
                     processJarFile(f, pluginName);
                 }
-            } catch(PluginException e){
+            } catch (PluginException e){
+                System.err.println(e.getMessage());
                 System.err.println(tr("Warning: Failed to scan file ''{0}'' for plugin information. Skipping.", fname));
-                e.printStackTrace();
             }
             monitor.worked(1);
