From 17f5719caf182eb33765fa6f5b4b65160f7d1154 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 27 May 2021 09:30:17 +0200 Subject: [PATCH] Gracefully handle malformed additional board manager urls --- .../packages/ContributionsIndexer.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/arduino-core/src/cc/arduino/contributions/packages/ContributionsIndexer.java b/arduino-core/src/cc/arduino/contributions/packages/ContributionsIndexer.java index 3e68d847e..b0db6ca19 100644 --- a/arduino-core/src/cc/arduino/contributions/packages/ContributionsIndexer.java +++ b/arduino-core/src/cc/arduino/contributions/packages/ContributionsIndexer.java @@ -144,12 +144,17 @@ public class ContributionsIndexer { index.fillCategories(); } - private List get3rdPartyIndexFiles() throws MalformedURLException { + private List get3rdPartyIndexFiles() { List indexFiles = new ArrayList<>(); for (String urlString : PreferencesData.getCollection(Constants.PREF_BOARDS_MANAGER_ADDITIONAL_URLS)) { - final URL url = new URL(urlString); - String filename = FilenameUtils.getName(url.getPath()); - indexFiles.add(getIndexFile(filename)); + URL url; + try { + 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) -> {