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

WS api/measures/component?additionalFields=metrics is failing on metrics without domain

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.6-M1, 6.6
    • Component/s: Web API
    • Labels:

      Description

      When api/measures/component (component_tree also fails) is called on metrics without domain, it's failing :

      2017.07.10 07:00:59 ERROR web[][o.s.s.w.WebServiceEngine] Fail to process request http://localhost:9020/api/measures/component?additionalFields=metrics,periods&componentKey=COMPONENT_KEY&metricKeys=METRIC_KEY
      java.lang.NullPointerException: null
                      at org.sonarqube.ws.Common$Metric$Builder.setDomain(Common.java:8353) ~[sonar-ws-6.1.jar:na]
                      at org.sonar.server.measure.ws.MetricDtoToWsMetric.metricDtoToWsMetric(MetricDtoToWsMetric.java:40) ~[sonar-server-6.1.jar:na]
                      at org.sonar.server.measure.ws.ComponentAction.buildResponse(ComponentAction.java:188) ~[sonar-server-6.1.jar:na]
                      at org.sonar.server.measure.ws.ComponentAction.doHandle(ComponentAction.java:146) ~[sonar-server-6.1.jar:na]
                      at org.sonar.server.measure.ws.ComponentAction.handle(ComponentAction.java:130) ~[sonar-server-6.1.jar:na]
                      at org.sonar.server.ws.WebServiceEngine.execute(WebServiceEngine.java:109) ~[sonar-server-6.1.jar:na]
                      at org.sonar.server.ws.WebServiceFilter.doFilter(WebServiceFilter.java:74) [sonar-server-6.1.jar:na]
                      at org.sonar.server.platform.web.MasterServletFilter$GodFilterChain.doFilter(MasterServletFilter.java:126) [sonar-server-6.1.jar:na]
                      at org.sonar.server.platform.web.MasterServletFilter.doFilter(MasterServletFilter.java:95) [sonar-server-6.1.jar:na]
                      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.32.jar:8.0.32]
                      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
                      at org.sonar.server.user.UserSessionFilter.doFilter(UserSessionFilter.java:60) [sonar-server-6.1.jar:na]
                      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.32.jar:8.0.32]
                      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
                      at org.sonar.server.platform.web.RoutesFilter.doFilter(RoutesFilter.java:55) [sonar-server-6.1.jar:na]
                      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.32.jar:8.0.32]
                      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
                      at org.sonar.server.platform.web.RootFilter.doFilter(RootFilter.java:113) [sonar-server-6.1.jar:na]
                      at org.sonar.server.platform.web.RootFilter.doFilter(RootFilter.java:81) [sonar-server-6.1.jar:na]
                      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.32.jar:8.0.32]
                      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
                      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) [tomcat-embed-core-8.0.32.jar:8.0.32]
                      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) [tomcat-embed-core-8.0.32.jar:8.0.32]
                      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) [tomcat-embed-core-8.0.32.jar:8.0.32]
                      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [tomcat-embed-core-8.0.32.jar:8.0.32]
                      at ch.qos.logback.access.tomcat.LogbackValve.invoke(LogbackValve.java:191) [logback-access-1.1.3.jar:na]
                      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) [tomcat-embed-core-8.0.32.jar:8.0.32]
                      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522) [tomcat-embed-core-8.0.32.jar:8.0.32]
                      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095) [tomcat-embed-core-8.0.32.jar:8.0.32]
                      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672) [tomcat-embed-core-8.0.32.jar:8.0.32]
                      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500) [tomcat-embed-core-8.0.32.jar:8.0.32]
                      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456) [tomcat-embed-core-8.0.32.jar:8.0.32]
                      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_131]
                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_131]
                      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.0.32.jar:8.0.32]
                      at java.lang.Thread.run(Unknown Source) [na:1.8.0_131]
      

      Note that creating a custom metric from the UI is creating a metric with an empty domain, not a null domain.
      To reproduce this issue, a metric should be defined using org.sonar.api.measures.Metrics.

        Attachments

          Activity

            People

            Assignee:
            teryk.bellahsene Teryk Bellahsene
            Reporter:
            julien.lancelot Julien Lancelot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Due:
              Created:
              Updated:
              Resolved: