Skip to content

Commit cd3639a

Browse files
committed
Print error if library.index is not parsed. Update index only after successful parsing.
1 parent b832e0d commit cd3639a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

arduino-core/src/cc/arduino/contributions/libraries/LibrariesIndexer.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,16 @@ private void parseIndex(File file) throws IOException {
8989
mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
9090
mapper.configure(DeserializationFeature.EAGER_DESERIALIZER_FETCH, true);
9191
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
92-
index = mapper.readValue(indexIn, LibrariesIndex.class);
92+
LibrariesIndex newIndex = mapper.readValue(indexIn, LibrariesIndex.class);
9393

94-
index.getLibraries()
94+
newIndex.getLibraries()
9595
.stream()
9696
.filter(library -> library.getCategory() == null || "".equals(library.getCategory()) || !Constants.LIBRARY_CATEGORIES.contains(library.getCategory()))
9797
.forEach(library -> library.setCategory("Uncategorized"));
98+
99+
index = newIndex;
100+
} catch (Exception e) {
101+
System.err.println("Error parsing library.index:" + e.getMessage());
98102
} finally {
99103
IOUtils.closeQuietly(indexIn);
100104
}

0 commit comments

Comments
 (0)