From 9dba7f0da0ef50692adc4b03941f3cae02d56cd6 Mon Sep 17 00:00:00 2001 From: Sandeep Mistry Date: Mon, 14 Mar 2016 17:28:19 -0400 Subject: [PATCH] Catch and report errors parsing contributed index files --- .../contributions/packages/ContributionsIndexer.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/arduino-core/src/cc/arduino/contributions/packages/ContributionsIndexer.java b/arduino-core/src/cc/arduino/contributions/packages/ContributionsIndexer.java index 047463db8..aa680b869 100644 --- a/arduino-core/src/cc/arduino/contributions/packages/ContributionsIndexer.java +++ b/arduino-core/src/cc/arduino/contributions/packages/ContributionsIndexer.java @@ -36,6 +36,8 @@ import cc.arduino.contributions.SignatureVerificationFailedException; import cc.arduino.contributions.SignatureVerifier; import cc.arduino.contributions.filters.BuiltInPredicate; import cc.arduino.contributions.filters.InstalledPredicate; + +import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.module.mrbean.MrBeanModule; @@ -87,8 +89,13 @@ public class ContributionsIndexer { File[] indexFiles = preferencesFolder.listFiles(new TestPackageIndexFilenameFilter(new PackageIndexFilenameFilter(Constants.DEFAULT_INDEX_FILE_NAME))); for (File indexFile : indexFiles) { - ContributionsIndex contributionsIndex = parseIndex(indexFile); - mergeContributions(contributionsIndex, indexFile); + try { + ContributionsIndex contributionsIndex = parseIndex(indexFile); + mergeContributions(contributionsIndex, indexFile); + } catch (JsonProcessingException e) { + System.err.println(I18n.format("Skipping contributed index file {0}, parsing error occured:", indexFile)); + System.err.println(e); + } } List packages = index.getPackages();