@@ -592,11 +592,7 @@ static public void initPackages() throws Exception {
592
592
593
593
try {
594
594
indexer .parseIndex ();
595
- } catch (JsonProcessingException e ) {
596
- FileUtils .deleteIfExists (indexFile );
597
- FileUtils .deleteIfExists (indexSignatureFile );
598
- throw e ;
599
- } catch (SignatureVerificationFailedException e ) {
595
+ } catch (JsonProcessingException | SignatureVerificationFailedException e ) {
600
596
FileUtils .deleteIfExists (indexFile );
601
597
FileUtils .deleteIfExists (indexSignatureFile );
602
598
throw e ;
@@ -611,6 +607,17 @@ static public void initPackages() throws Exception {
611
607
612
608
librariesIndexer = new LibrariesIndexer (BaseNoGui .getSettingsFolder (), indexer );
613
609
File librariesIndexFile = librariesIndexer .getIndexFile ();
610
+ copyStockLibraryIndexIfUpstreamIsMissing (librariesIndexFile );
611
+ try {
612
+ librariesIndexer .parseIndex ();
613
+ } catch (JsonProcessingException e ) {
614
+ FileUtils .deleteIfExists (librariesIndexFile );
615
+ copyStockLibraryIndexIfUpstreamIsMissing (librariesIndexFile );
616
+ librariesIndexer .parseIndex ();
617
+ }
618
+ }
619
+
620
+ private static void copyStockLibraryIndexIfUpstreamIsMissing (File librariesIndexFile ) throws IOException {
614
621
if (!librariesIndexFile .isFile ()) {
615
622
File defaultLibraryJsonFile = new File (getContentFile ("dist" ), "library_index.json" );
616
623
if (defaultLibraryJsonFile .isFile ()) {
@@ -628,12 +635,6 @@ static public void initPackages() throws Exception {
628
635
}
629
636
}
630
637
}
631
- try {
632
- librariesIndexer .parseIndex ();
633
- } catch (JsonProcessingException e ) {
634
- FileUtils .deleteIfExists (librariesIndexFile );
635
- throw e ;
636
- }
637
638
}
638
639
639
640
static protected void initPlatform () {
0 commit comments