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

NPE when pull request decorator is triggered on a branch that is not a PR

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 7.1
    • Fix Version/s: 7.2
    • Component/s: Branch & PR
    • Labels:
      None
    • Edition:
      Developer

      Description

      PR decorators are supposed to execute only on PR. This is correctly implemented for execution after an analysis, but for "real time" updates (when issues are changed in the UI) there is nothing to check if the event come from a PR.
      It leads to this kind of WARN in logs (NPE is catched):

      2018.05.03 14:39:55 WARN  web[AWMmA3gal2XQDhs2AABA][o.s.s.q.c.QGChangeEventListenersImpl] onChange() call failed on listener com.sonarsource.branch.pr.PrIssueChangeEventListener for events QGChangeEvent{project=AWMf3G2x41b3hkXLMXL1:test-bitbucket-pr, branch=SHORT:AWMf3G2x41b3hkXLMXL1:AWMf0kV4e4I6G84UZfjw:AWMf0kV4e4I6G84UZfjw, analysis=AWMf4CtX41b3hkXLMXN-:1525248169412, projectConfiguration=org.sonar.api.config.internal.ConfigurationBridge@3d1149c1, previousStatus=ERROR, qualityGateSupplier=org.sonar.server.measure.live.LiveMeasureComputerImpl$$Lambda$1556/552178336@905d840}
      java.lang.NullPointerException: null
              at com.sonarsource.branch.pr.PrIssueChangeEventListener.lambda$onChange$2(PrIssueChangeEventListener.java:50)
              at java.util.Optional.ifPresent(Optional.java:159)
              at com.sonarsource.branch.pr.PrIssueChangeEventListener.onChange(PrIssueChangeEventListener.java:48)
              at com.sonarsource.branch.pr.PrIssueChangeEventListener.onIssueChanges(PrIssueChangeEventListener.java:43)
              at org.sonar.server.qualitygate.changeevent.QGChangeEventListenersImpl.broadcastTo(QGChangeEventListenersImpl.java:94)
              at org.sonar.server.qualitygate.changeevent.QGChangeEventListenersImpl.lambda$broadcastOnIssueChange$2(QGChangeEventListenersImpl.java:83)
              at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
              at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
              at org.sonar.server.qualitygate.changeevent.QGChangeEventListenersImpl.lambda$broadcastOnIssueChange$3(QGChangeEventListenersImpl.java:83)
              at java.lang.Iterable.forEach(Iterable.java:75)
              at org.sonar.server.qualitygate.changeevent.QGChangeEventListenersImpl.lambda$broadcastOnIssueChange$4(QGChangeEventListenersImpl.java:82)
      

      or with obfuscation:

      2018.04.27 00:31:30 WARN  web[AWL3OF1hGDAfY81IB/Vl][o.s.s.q.c.QGChangeEventListenersImpl] onChange() call failed on listener com.sonarsource.branch.pr.K for events QGChangeEvent{project=AWMCsGTrOnVewt-wirZH:space.npstr.
      SqlSauce:SqlSauce, branch=LONG:AWMCsGTrOnVewt-wirZH:AWMCsGTrOnVewt-wirZH:null, analysis=AWMEEPIafKfZeQj718x0:1524781594161, projectConfiguration=org.sonar.api.config.internal.ConfigurationBridge@364e13de, previousStatus
      =ERROR, qualityGateSupplier=org.sonar.server.measure.live.LiveMeasureComputerImpl$$Lambda$2255/1452569225@6872c0bc}
      java.lang.NullPointerException: null
              at com.sonarsource.branch.pr.K.A(Unknown Source)
              at java.util.Optional.ifPresent(Optional.java:159)
              at com.sonarsource.branch.pr.K.A(Unknown Source)
              at com.sonarsource.branch.pr.K.onIssueChanges(Unknown Source)
              at org.sonar.server.qualitygate.changeevent.QGChangeEventListenersImpl.broadcastTo(QGChangeEventListenersImpl.java:94)
              at org.sonar.server.qualitygate.changeevent.QGChangeEventListenersImpl.lambda$null$2(QGChangeEventListenersImpl.java:83)
              at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
              at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
              at org.sonar.server.qualitygate.changeevent.QGChangeEventListenersImpl.lambda$null$3(QGChangeEventListenersImpl.java:83)
              at java.lang.Iterable.forEach(Iterable.java:75)
              at org.sonar.server.qualitygate.changeevent.QGChangeEventListenersImpl.lambda$broadcastOnIssueChange$4(QGChangeEventListenersImpl.java:82)
      

        Attachments

          Activity

            People

            • Assignee:
              julien.henry Julien Henry
              Reporter:
              julien.henry Julien Henry
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved: