Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-11408

Functional error raised loading Metadata causes exception in task listener code

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 7.4, 7.5
    • Fix Version/s: 7.5
    • Component/s: Branch & PR, Compute Engine
    • Labels:
    • Edition:
      Developer
    • Production Notes:
      None

      Description

      When some MessageException related to branch validation are raised in step LoadReportAnalysisMetadataHolderStep then an exception is raised which fails the execution of all task listeners:

      Execution of listener failed
      java.lang.IllegalStateException: Branch has not been set
      	at com.google.common.base.Preconditions.checkState(Preconditions.java:173)
      	at org.sonar.ce.task.projectanalysis.analysis.AnalysisMetadataHolderImpl.getBranch(AnalysisMetadataHolderImpl.java:149)
      	at org.sonar.ce.task.projectanalysis.api.posttask.PostProjectAnalysisTasksExecutor.createBranch(PostProjectAnalysisTasksExecutor.java:184)
      	at org.sonar.ce.task.projectanalysis.api.posttask.PostProjectAnalysisTasksExecutor.createProjectAnalysis(PostProjectAnalysisTasksExecutor.java:128)
      	at org.sonar.ce.task.projectanalysis.api.posttask.PostProjectAnalysisTasksExecutor.finished(PostProjectAnalysisTasksExecutor.java:105)
      	at org.sonar.ce.task.step.ComputationStepExecutor.executeListener(ComputationStepExecutor.java:76)
      	at org.sonar.ce.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:59)
      	at org.sonar.ce.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(ReportTaskProcessor.java:81)
      	at org.sonar.ce.taskprocessor.CeWorkerImpl.executeTask(CeWorkerImpl.java:136)
      	at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(CeWorkerImpl.java:99)
      	at org.sonar.ce.taskprocessor.CeWorkerImpl.withCustomizedThreadName(CeWorkerImpl.java:83)
      	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:75)
      	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:45)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
      	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)
      

      This bug was introduced when extra validations were added in the branch information retrieved from the report and the CE task in SONAR-11310.

      This should be fixed by raising the validation error but populate the branch data anyway. In other words, raising the exception after the branch information has been populated.

      This fix is preferable over supporting the branch information not being populated when building the context for task listener:

      1. in the API, the branch information is not optional
      2. in case of failure, the branch information will be missing and listener won't be able to tell they were called on a branch

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sebastien.lesaint Sebastien Lesaint
              Reporter:
              sebastien.lesaint Sebastien Lesaint
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: