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

Publish Maven Indexes task SimpleDateFormat NullPointerException

    XMLWordPrintable

    Details

    • Story Points:
      2
    • Notability:
      3

      Description

      A PublishMavenIndexes task may fail with a NullPointerException processing the last published date:

      2017-07-20 09:23:58,690+0200 ERROR [quartz-2-thread-3] *SYSTEM org.sonatype.nexus.repository.maven.tasks.PublishMavenIndexTask - Failed to run task 'Publish Maven indexes of agfa-central' on repository 'agfa-central'
      java.lang.NullPointerException: null
      	at java.text.SimpleDateFormat.parse(SimpleDateFormat.java:1439)
      	at java.text.DateFormat.parse(DateFormat.java:364)
      	at org.apache.maven.index.reader.IndexReader.<init>(IndexReader.java:98)
      	at org.sonatype.nexus.repository.maven.internal.MavenIndexPublisher.lastPublished(MavenIndexPublisher.java:132)
      	at org.sonatype.nexus.repository.maven.internal.MavenIndexFacetSupport.lastPublished(MavenIndexFacetSupport.java:39)
      	at org.sonatype.nexus.repository.maven.internal.group.IndexGroupFacet.publishIndex(IndexGroupFacet.java:47)
      	at org.sonatype.nexus.repository.maven.tasks.PublishMavenIndexTask.execute(PublishMavenIndexTask.java:37)
      	at org.sonatype.nexus.repository.RepositoryTaskSupport.execute(RepositoryTaskSupport.java:56)
      	at org.sonatype.nexus.scheduling.TaskSupport.call(TaskSupport.java:89)
      	at org.sonatype.nexus.quartz.internal.task.QuartzTaskJob.doExecute(QuartzTaskJob.java:145)
      	at org.sonatype.nexus.quartz.internal.task.QuartzTaskJob.execute(QuartzTaskJob.java:108)
      	at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
      	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:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:748)
      2017-07-20 09:23:58,692+0200 WARN  [quartz-2-thread-3] *SYSTEM org.sonatype.nexus.quartz.internal.task.QuartzTaskJob - Task 458317f6-0259-43bf-82f4-c6583df6150c : 'Index Publisher' [repository.maven.publish-dotindex] execution failure
      org.sonatype.goodies.common.MultipleFailures$MultipleFailuresException: Failed to run task 'Publish Maven indexes of agfa-central'; 1 failure
      	at org.sonatype.goodies.common.MultipleFailures.maybePropagate(MultipleFailures.java:95)
      	at org.sonatype.nexus.repository.RepositoryTaskSupport.execute(RepositoryTaskSupport.java:64)
      	at org.sonatype.nexus.scheduling.TaskSupport.call(TaskSupport.java:89)
      	at org.sonatype.nexus.quartz.internal.task.QuartzTaskJob.doExecute(QuartzTaskJob.java:145)
      	at org.sonatype.nexus.quartz.internal.task.QuartzTaskJob.execute(QuartzTaskJob.java:108)
      	at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
      	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:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:748)
      	Suppressed: java.lang.NullPointerException: null
      		at java.text.SimpleDateFormat.parse(SimpleDateFormat.java:1439)
      		at java.text.DateFormat.parse(DateFormat.java:364)
      		at org.apache.maven.index.reader.IndexReader.<init>(IndexReader.java:98)
      		at org.sonatype.nexus.repository.maven.internal.MavenIndexPublisher.lastPublished(MavenIndexPublisher.java:132)
      		at org.sonatype.nexus.repository.maven.internal.MavenIndexFacetSupport.lastPublished(MavenIndexFacetSupport.java:39)
      		at org.sonatype.nexus.repository.maven.internal.group.IndexGroupFacet.publishIndex(IndexGroupFacet.java:47)
      		at org.sonatype.nexus.repository.maven.tasks.PublishMavenIndexTask.execute(PublishMavenIndexTask.java:37)
      		at org.sonatype.nexus.repository.RepositoryTaskSupport.execute(RepositoryTaskSupport.java:56)
      		... 12 common frames omitted
      

      Expected

      • runtime exceptions like NullPointerException should be avoided - it is a programming error - log a more specific message as to what expectations were not met and possibly why or bypass the problem entirely
      • in a rolled up suppressed exception displayed at end of task, when a task runs over multiple repositories ( All Repositories or a group repository with members ), the specific repository name where the exception was encountered would be minimum information to include, not just including the stack trace ( may need to be separate issue if something to be handled globally for all suppressed exceptions per repo ). In other words, we need to have it logged which hosted or proxy repository had the actual problem index.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              plynch Peter Lynch
              Last Updated By:
              Rich Seddon
              Votes:
              2 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated:
                Date of First Response:

                  tigCommentSecurity.panel-title