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

Better handle when a plugin returns null from Metrics::getMetrics

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.6-M3, 6.6
    • Component/s: Plugin API
    • Labels:
      None

      Description

      If a plugin returns null for Metrics::getMetrics, it fails badly. For example on 5.6.6:

      2017.08.03 12:25:23 ERROR [o.s.s.c.t.CeWorkerCallableImpl] Failed to execute task AV2nn6WUylLK-7NLSbg5
      java.lang.NullPointerException: null
              at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:213) ~[guava-17.0.jar:na]
              at com.google.common.collect.ImmutableCollection$ArrayBasedBuilder.add(ImmutableCollection.java:339) ~[guava-17.0.jar:na]
              at com.google.common.collect.ImmutableSet$Builder.add(ImmutableSet.java:480) ~[guava-17.0.jar:na]
              at com.google.common.collect.ImmutableSet$Builder.add(ImmutableSet.java:456) ~[guava-17.0.jar:na]
              at com.google.common.collect.ImmutableCollection$Builder.addAll(ImmutableCollection.java:301) ~[guava-17.0.jar:na]
              at com.google.common.collect.ImmutableSet$Builder.addAll(ImmutableSet.java:522) ~[guava-17.0.jar:na]
              at com.google.common.collect.ImmutableSet.copyOf(ImmutableSet.java:321) ~[guava-17.0.jar:na]
              at com.google.common.collect.ImmutableSet.copyOf(ImmutableSet.java:300) ~[guava-17.0.jar:na]
              at org.sonar.core.metric.ScannerMetrics.<init>(ScannerMetrics.java:157) ~[sonar-core-5.6.6.jar:na]
              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_131]
              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_131]
              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_131]
              at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_131]
              at org.picocontainer.injectors.AbstractInjector.newInstance(AbstractInjector.java:145) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:342) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647) ~[picocontainer-2.15.jar:na]
              at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:678) ~[picocontainer-2.15.jar:na]
              at org.sonar.core.platform.ComponentContainer.getComponentByType(ComponentContainer.java:272) ~[sonar-core-5.6.6.jar:na]
              at org.sonar.server.computation.step.AbstractComputationSteps$1.apply(AbstractComputationSteps.java:43) ~[sonar-server-5.6.6.jar:na]
              at org.sonar.server.computation.step.AbstractComputationSteps$1.apply(AbstractComputationSteps.java:40) ~[sonar-server-5.6.6.jar:na]
              at com.google.common.collect.Iterators$8.transform(Iterators.java:794) ~[guava-17.0.jar:na]
              at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48) ~[guava-17.0.jar:na]
              at org.sonar.server.computation.step.ComputationStepExecutor.executeSteps(ComputationStepExecutor.java:62) ~[sonar-server-5.6.6.jar:na]
              at org.sonar.server.computation.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:52) ~[sonar-server-5.6.6.jar:na]
              at org.sonar.server.computation.taskprocessor.report.ReportTaskProcessor.process(ReportTaskProcessor.java:75) ~[sonar-server-5.6.6.jar:na]
              at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.executeTask(CeWorkerCallableImpl.java:81) [sonar-server-5.6.6.jar:na]
              at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.call(CeWorkerCallableImpl.java:56) [sonar-server-5.6.6.jar:na]
              at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.call(CeWorkerCallableImpl.java:35) [sonar-server-5.6.6.jar:na]
              at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_131]
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_131]
              at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_131]
              at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_131]
              at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_131]
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_131]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_131]
              at java.lang.Thread.run(Thread.java:748) [na:1.8.0_131]
      

      https://groups.google.com/forum/#!topic/sonarqube/5KIa3SpW7SU

        Attachments

          Activity

            People

            Assignee:
            janos.gyerik Janos Gyerik
            Reporter:
            julien.henry Julien Henry
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Due:
              Created:
              Updated:
              Resolved: