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

Null change can be added in DefaultIssue, causing report analysis to fail

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 7.3
    • Fix Version/s: 7.4
    • Component/s: Compute Engine
    • Labels:
    • Edition:
      Community
    • Production Notes:
      None

      Description

      The following error was encounterd on SonarCloud:

      java.lang.NullPointerException: at index 0
      	at com.google.common.collect.ObjectArrays.checkElementNotNull(ObjectArrays.java:240)
      	at com.google.common.collect.ObjectArrays.checkElementsNotNull(ObjectArrays.java:231)
      	at com.google.common.collect.ObjectArrays.checkElementsNotNull(ObjectArrays.java:226)
      	at com.google.common.collect.ImmutableList.construct(ImmutableList.java:303)
      	at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:258)
      	at org.sonar.core.issue.DefaultIssue.changes(DefaultIssue.java:529)
      	at org.sonar.server.issue.IssueStorage.insertChanges(IssueStorage.java:38)
      	at org.sonar.ce.task.projectanalysis.step.PersistIssuesStep.execute(PersistIssuesStep.java:67)
      	at org.sonar.ce.task.step.ComputationStepExecutor.executeSteps(ComputationStepExecutor.java:69)
      	at org.sonar.ce.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:55)
      	at org.sonar.ce.task.projectanalysis.taskprocessor.ReportTaskProcessor.process
      

      The situation that lead to an issue to have a null change (failure occurred at index 0, there may be only this one null change in the copied collection) is very hard to track: error occurred while persisting all issues and they may have been created in various fashion. There is no way to know which single (or multiple) fashion is responsible for the error.

      Still, it would be easy to prevent such error to occur by preventing nulls to be added to DefaultIssue class (see https://github.com/SonarSource/sonar-enterprise/blob/master/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java#L517)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              benoit.gianinetti Benoit Gianinetti (Inactive)
              Reporter:
              sebastien.lesaint Sebastien Lesaint
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: