Changeset 9621 in josm for trunk/src/org/openstreetmap/josm/plugins/PluginDownloadTask.java
- Timestamp:
- 2016-01-25T00:36:01+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/plugins/PluginDownloadTask.java
r9309 r9621 30 30 * When the task is finished {@link #getDownloadedPlugins()} replies the list of downloaded plugins 31 31 * and {@link #getFailedPlugins()} replies the list of failed plugins. 32 * 32 * @since 2817 33 33 */ 34 34 public class PluginDownloadTask extends PleaseWaitRunnable { … … 43 43 private final Collection<PluginInformation> failed = new LinkedList<>(); 44 44 private final Collection<PluginInformation> downloaded = new LinkedList<>(); 45 private Exception lastException; 45 46 private boolean canceled; 46 47 private HttpClient downloadConnection; … … 97 98 98 99 @Override 99 protected void finish() {} 100 protected void finish() { 101 // Do nothing. Error/success feedback is managed in PluginPreference.notifyDownloadResults() 102 } 100 103 101 104 protected void download(PluginInformation pi, File file) throws PluginDownloadException { … … 150 153 File pluginDir = Main.pref.getPluginsDirectory(); 151 154 if (!pluginDir.exists() && !pluginDir.mkdirs()) { 152 /*lastException =*/ new PluginDownloadException(tr("Failed to create plugin directory ''{0}''", pluginDir.toString())); 155 String message = tr("Failed to create plugin directory ''{0}''", pluginDir.toString()); 156 lastException = new PluginDownloadException(message); 157 Main.error(message); 153 158 failed.addAll(toUpdate); 154 159 return; … … 156 161 getProgressMonitor().setTicksCount(toUpdate.size()); 157 162 for (PluginInformation d : toUpdate) { 158 if (canceled) return; 163 if (canceled) 164 return; 159 165 String message = tr("Downloading Plugin {0}...", d.name); 160 166 Main.info(message); … … 165 171 download(d, pluginFile); 166 172 } catch (PluginDownloadException e) { 173 lastException = e; 167 174 Main.error(e); 168 175 failed.add(d); … … 200 207 return downloaded; 201 208 } 209 210 /** 211 * Replies the last exception that occured during download, or {@code null}. 212 * @return the last exception that occured during download, or {@code null} 213 * @since 9621 214 */ 215 public Exception getLastException() { 216 return lastException; 217 } 202 218 }
Note:
See TracChangeset
for help on using the changeset viewer.