- Timestamp:
- 2020-12-07T10:58:03+01:00 (3 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/bugreport/BugReportDialog.java
r14176 r17392 230 230 return SuppressionMode.NONE; 231 231 } else { 232 PluginDownloadTask downloadTask = PluginHandler.updateOrdisablePluginAfterException(e); 232 233 return GuiHelper.runInEDTAndWaitAndReturn(() -> { 233 PluginDownloadTask downloadTask = PluginHandler.updateOrdisablePluginAfterException(e);234 234 if (downloadTask != null) { 235 235 // Ask for restart to install new plugin -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r17390 r17392 38 38 import java.util.concurrent.CopyOnWriteArrayList; 39 39 import java.util.concurrent.ExecutionException; 40 import java.util.concurrent.Future; 40 41 import java.util.concurrent.FutureTask; 41 42 import java.util.concurrent.TimeUnit; … … 954 955 } 955 956 try { 957 Map<String, PluginInformation> ret = new HashMap<>(); 956 958 ReadLocalPluginInformationTask task = new ReadLocalPluginInformationTask(monitor); 959 Future<?> future = MainApplication.worker.submit(task); 957 960 try { 958 task.run();959 } catch ( RuntimeException e) { // NOPMD961 future.get(); 962 } catch (ExecutionException e) { 960 963 Logging.error(e); 961 return null; 962 } 963 Map<String, PluginInformation> ret = new HashMap<>(); 964 return ret; 965 } catch (InterruptedException e) { 966 Logging.warn("InterruptedException in " + PluginHandler.class.getSimpleName() 967 + " while loading locally available plugin information"); 968 return ret; 969 } 964 970 for (PluginInformation pi: task.getAvailablePlugins()) { 965 971 ret.put(pi.name, pi); … … 1118 1124 monitor.createSubTaskMonitor(1, false), 1119 1125 Preferences.main().getOnlinePluginSites(), displayErrMsg 1120 );1121 task1.run();1122 List<PluginInformation> allPlugins = task1.getAvailablePlugins();1126 ); 1127 List<PluginInformation> allPlugins = null; 1128 Future<?> future = MainApplication.worker.submit(task1); 1123 1129 1124 1130 try { 1131 future.get(); 1132 allPlugins = task1.getAvailablePlugins(); 1125 1133 plugins = buildListOfPluginsToLoad(parent, monitor.createSubTaskMonitor(1, false)); 1126 1134 // If only some plugins have to be updated, filter the list … … 1129 1137 plugins = SubclassFilteredCollection.filter(plugins, pi -> pluginsWantedName.contains(pi.name)); 1130 1138 } 1131 } catch ( RuntimeException e) { // NOPMD1132 Logging.warn(tr("Failed to download plugin information list") );1139 } catch (ExecutionException e) { 1140 Logging.warn(tr("Failed to download plugin information list") + ": ExecutionException"); 1133 1141 Logging.error(e); 1142 // don't abort in case of error, continue with downloading plugins below 1143 } catch (InterruptedException e) { 1144 Logging.warn(tr("Failed to download plugin information list") + ": InterruptedException"); 1134 1145 // don't abort in case of error, continue with downloading plugins below 1135 1146 } … … 1170 1181 pluginsToDownload, 1171 1182 tr("Update plugins") 1172 ); 1183 ); 1184 future = MainApplication.worker.submit(pluginDownloadTask); 1185 1173 1186 try { 1174 pluginDownloadTask.run();1175 } catch ( RuntimeException e) { // NOPMD1187 future.get(); 1188 } catch (ExecutionException e) { 1176 1189 Logging.error(e); 1190 alertFailedPluginUpdate(parent, pluginsToUpdate); 1191 return plugins; 1192 } catch (InterruptedException e) { 1193 Logging.warn("InterruptedException in " + PluginHandler.class.getSimpleName() 1194 + " while updating plugins"); 1177 1195 alertFailedPluginUpdate(parent, pluginsToUpdate); 1178 1196 return plugins;
Note:
See TracChangeset
for help on using the changeset viewer.