Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-26205

Publish Maven Indexer files task against a group repository can cause NullPointerException

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: New
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.13.0, 3.15.2, 3.28.1
    • Fix Version/s: None
    • Component/s: Maven, Scheduled Tasks
    • Labels:
    • Notability:
      3

      Description

      SYMPTOM:

      Running "Maven - Publish Maven Indexer files" against a group repository which has many members can cause NullPointerException, if somehow at least one member repository failed to generate the "nexus-maven-repository-index.gz" file.

      REPRODUCE STEPS:

      Simplified steps are below:

      1. Create a maven proxy repo against "http://maven.onehippo.com/maven2-forge/" (this one doesn't generate the large index so good for testing)
      2. Run the Publish Maven Indexer files task against this proxy repo
      3. From UI => Browse => this proxy repo, select .index/nexus-maven-repository-index.gz and delete (NOTE: do not delete the .properties file)
      4. Create a maven group repo which contains above proxy repo
      5. Run the Publish Maven Indexer files task against this group repo

      EXPECTED BEHAVIOUR:

      Probably, org.sonatype.nexus.repository.maven.internal.MavenIndexPublisher#getRecords should catch the 'null', so that the failed maven proxy repo will be skipped with below INFO log in the task log:

      2020-12-22 18:21:22,756+1000 INFO  [quartz-9-thread-7]  *SYSTEM org.sonatype.nexus.repository.maven.internal.orient.OrientMavenIndexPublisher - Following members of group maven-group-test have no index, will not participate in merged index: [maven-proxy-test]
      

      ACTUAL BEHAVIOUR:

      The task fails with below ERROR:

      2020-12-22 18:20:29,241+1000 ERROR [quartz-9-thread-7]  *SYSTEM org.sonatype.nexus.repository.maven.tasks.PublishMavenIndexTask - Failed to run task 'Publish Maven indexes of maven-group-test' on repository 'maven-group-test'
      java.lang.NullPointerException: null
              at java.util.zip.InflaterInputStream.<init>(InflaterInputStream.java:83)
              at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:77)
              at org.apache.maven.index.reader.ChunkReader.<init>(ChunkReader.java:55)
              at org.apache.maven.index.reader.IndexReader$ChunkReaderIterator.next(IndexReader.java:260)
              at org.apache.maven.index.reader.IndexReader$ChunkReaderIterator.next(IndexReader.java:233)
              at org.sonatype.nexus.repository.maven.internal.MavenIndexPublisher.getRecords(MavenIndexPublisher.java:120)
              at org.sonatype.nexus.repository.maven.internal.orient.OrientMavenIndexPublisher.getGroupRecords(OrientMavenIndexPublisher.java:123)
              at org.sonatype.nexus.repository.maven.internal.MavenIndexPublisher.publishMergedIndex(MavenIndexPublisher.java:191)
              at org.sonatype.nexus.repository.maven.internal.MavenIndexPublisher.publishGroupIndex(MavenIndexPublisher.java:153)
              at org.sonatype.nexus.repository.maven.internal.orient.OrientMavenGroupIndexFacet.publishIndex(OrientMavenGroupIndexFacet.java:58)
              at org.sonatype.nexus.repository.maven.tasks.PublishMavenIndexTask.execute(PublishMavenIndexTask.java:37)
              at org.sonatype.nexus.repository.RepositoryTaskSupport.execute(RepositoryTaskSupport.java:79)
              at org.sonatype.nexus.scheduling.TaskSupport.call(TaskSupport.java:100)
              at org.sonatype.nexus.quartz.internal.task.QuartzTaskJob.doExecute(QuartzTaskJob.java:143)
              at org.sonatype.nexus.quartz.internal.task.QuartzTaskJob.execute(QuartzTaskJob.java:106)
              at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
              at org.sonatype.nexus.quartz.internal.QuartzThreadPool.lambda$0(QuartzThreadPool.java:145)
              at org.sonatype.nexus.thread.internal.MDCAwareRunnable.run(MDCAwareRunnable.java:40)
              at org.apache.shiro.subject.support.SubjectRunnable.doRun(SubjectRunnable.java:120)
              at org.apache.shiro.subject.support.SubjectRunnable.run(SubjectRunnable.java:108)
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
              at java.util.concurrent.FutureTask.run(FutureTask.java:266)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
              at java.lang.Thread.run(Thread.java:748)
      

      WORKAROUND:

      Remove .index/nexus-maven-repository-index.properties from the offending maven proxy repo.
      Then, if the remote is working, run the publish task against this maven proxy repo.
      If the remote is not working, then use the Unpublish Maven Indexer files task to unpublish this maven proxy repo's index.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            hosako Hajime Osako
            Last Updated By:
            Joe Tom Joe Tom
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                tigCommentSecurity.panel-title