1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-11-28 09:24:14 +01:00

Gracefully handle malformed additional board manager urls

This commit is contained in:
Cristian Maglie 2021-05-27 09:30:17 +02:00
parent c4109e78bc
commit 17f5719caf

View File

@ -144,12 +144,17 @@ public class ContributionsIndexer {
index.fillCategories(); index.fillCategories();
} }
private List<File> get3rdPartyIndexFiles() throws MalformedURLException { private List<File> get3rdPartyIndexFiles() {
List<File> indexFiles = new ArrayList<>(); List<File> indexFiles = new ArrayList<>();
for (String urlString : PreferencesData.getCollection(Constants.PREF_BOARDS_MANAGER_ADDITIONAL_URLS)) { for (String urlString : PreferencesData.getCollection(Constants.PREF_BOARDS_MANAGER_ADDITIONAL_URLS)) {
final URL url = new URL(urlString); URL url;
String filename = FilenameUtils.getName(url.getPath()); try {
indexFiles.add(getIndexFile(filename)); url = new URL(urlString);
String filename = FilenameUtils.getName(url.getPath());
indexFiles.add(getIndexFile(filename));
} catch (MalformedURLException e) {
System.err.println(format(tr("Malformed Additional Board Manager URL '{0}': {1}"), urlString, e.getMessage()));
}
} }
File[] testIndexFiles = preferencesFolder.listFiles((dir, name) -> { File[] testIndexFiles = preferencesFolder.listFiles((dir, name) -> {