Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/plugins/PluginDownloader.java

    r1732 r1733  
    1111import java.io.BufferedWriter;
    1212import java.io.File;
    13 import java.io.FileNotFoundException;
    1413import java.io.FileOutputStream;
    15 import java.io.FileWriter;
    1614import java.io.FilenameFilter;
    1715import java.io.IOException;
     
    2018import java.io.OutputStream;
    2119import java.io.OutputStreamWriter;
    22 import java.net.MalformedURLException;
    2320import java.net.URL;
    2421import java.util.Arrays;
    25 import java.util.concurrent.Future;
    2622import java.util.Collection;
    2723import java.util.LinkedList;
     
    2925import javax.swing.JOptionPane;
    3026
     27import org.openstreetmap.josm.Main;
    3128import org.openstreetmap.josm.actions.AboutAction;
    32 import org.openstreetmap.josm.Main;
    3329import org.openstreetmap.josm.gui.ExtendedDialog;
    3430import org.openstreetmap.josm.gui.PleaseWaitRunnable;
     
    6662            if (!pluginDir.exists())
    6763                pluginDir.mkdirs();
     64            Main.pleaseWaitDlg.progress.setMaximum(toUpdate.size());
     65            int progressValue = 0;
    6866            for (PluginInformation d : toUpdate) {
     67                Main.pleaseWaitDlg.progress.setValue(progressValue++);
    6968                Main.pleaseWaitDlg.currentAction.setText(tr("Downloading Plugin {0}...", d.name));
    7069                File pluginFile = new File(pluginDir, d.name + ".jar.new");
     
    145144
    146145    public Collection<PluginInformation> download(Collection<PluginInformation> download) {
     146        // Execute task in current thread instead of executing it in other thread and waiting for result
     147        // Waiting for result is not a good idea because the waiting thread will probably be either EDT
     148        // or worker thread. Blocking one of these threads will cause deadlock
    147149        UpdateTask t = new UpdateTask(download, false);
    148         try {
    149             Future<UpdateTask> ta = Main.worker.submit(t, t);
    150             t = ta.get();
    151             return t.failed;
    152         }
    153         catch(java.lang.InterruptedException e) {e.printStackTrace();}
    154         catch(java.util.concurrent.ExecutionException e) {e.printStackTrace();}
    155         return download;
     150        t.run();
     151        return t.failed;
    156152    }
    157153
Note: See TracChangeset for help on using the changeset viewer.