4444import java .util .regex .Matcher ;
4545import java .util .regex .Pattern ;
4646import java .util .stream .Stream ;
47- import java .util .zip .ZipError ;
4847import org .apache .lucene .index .DirectoryReader ;
4948import org .apache .lucene .index .IndexableField ;
5049import org .apache .lucene .index .Term ;
@@ -886,10 +885,8 @@ public void updateIndexWithArtifacts(final RepositoryInfo repo, final Collection
886885 BooleanQuery bq = new BooleanQuery .Builder ()
887886 .add (new BooleanClause (new PrefixQuery (new Term (ArtifactInfo .UINFO , id )), BooleanClause .Occur .MUST ))
888887 .build ();
889- IteratorSearchResponse response = repeatedPagedSearch (bq , indexingContext , MAX_RESULT_COUNT );
890- add = response == null || response .getTotalHitsCount () == 0 ;
891- if (response != null ) {
892- response .close ();
888+ try (IteratorSearchResponse response = repeatedPagedSearch (bq , indexingContext , MAX_RESULT_COUNT )) {
889+ add = response == null || response .getTotalHitsCount () == 0 ;
893890 }
894891 }
895892 if (add ) {
@@ -903,17 +900,16 @@ public void updateIndexWithArtifacts(final RepositoryInfo repo, final Collection
903900 }
904901
905902 }
906- try {
907- indexer .addArtifactsToIndex (artifactContexts , indexingContext );
908- storeGroupCache (repo , indexingContext );
909- } catch (ZipError err ) {
910- LOGGER .log (Level .INFO , "#230581 concurrent access to local repository file. Skipping.." , err );
911- }
903+ indexer .addArtifactsToIndex (artifactContexts , indexingContext );
904+ storeGroupCache (repo , indexingContext );
912905
913906 return null ;
914907 });
915908 } catch (MutexException ex ) {
916- Exceptions .printStackTrace (ex );
909+ List <Artifact > sample = artifacts .stream ().limit (5 ).toList ();
910+ LOGGER .log (Level .WARNING ,
911+ "Unable to update index with artifact(s): " + sample
912+ + (artifacts .size () > sample .size () ? (" +" + (artifacts .size () - sample .size ()) + " more" ) : "" ), ex );
917913 } catch (NullPointerException x ) {
918914 LOGGER .log (Level .INFO , "#201057" , x );
919915 }
0 commit comments