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

Setting a percentage in the metric value of a measure filter breaks the search

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.2
    • Component/s: Measures
    • Labels:
      None

      Description

      To reproduce:

      • Go to "Measures"
      • Search for files that have a comment density (Comments %) higher than 20%
        • If you set "20" in the text field, it works OK
        • if you set "20%", you get the following error:
      2013.10.25 15:43:11 ERROR o.s.MEASURE_FILTER  Fail to execute measure filter: MeasureFilterContext[filter={display=list|cols=metric:alert_statusnamedatemetric:nclocmetric:violationslinks|sort=name|asc=true|pageSize=100|qualifiers=FIL|c3_metric=complexity|c3_op=lt|c3_val=20%},sql=<null>,user=1]
      java.lang.NumberFormatException: For input string: "20%"
              at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1241) ~[na:1.7.0-u8-b05]
              at java.lang.Double.parseDouble(Double.java:540) ~[na:1.7.0-u8-b05]
              at org.sonar.core.measure.MeasureFilterFactory.toCondition(MeasureFilterFactory.java:136) ~[sonar-core-4.1-SNAPSHOT.jar:na]
              at org.sonar.core.measure.MeasureFilterFactory.fillMeasureConditions(MeasureFilterFactory.java:99) ~[sonar-core-4.1-SNAPSHOT.jar:na]
              at org.sonar.core.measure.MeasureFilterFactory.create(MeasureFilterFactory.java:72) ~[sonar-core-4.1-SNAPSHOT.jar:na]
              at org.sonar.core.measure.MeasureFilterEngine.execute(MeasureFilterEngine.java:57) [sonar-core-4.1-SNAPSHOT.jar:na]
              at org.sonar.core.measure.MeasureFilterEngine.execute(MeasureFilterEngine.java:46) [sonar-core-4.1-SNAPSHOT.jar:na]
              at org.sonar.server.ui.JRubyFacade.executeMeasureFilter(JRubyFacade.java:104) [JRubyFacade.class:na]
              ... etc ...
      

      We should:

      • fix the issue on the Java service side
      • and make it clear for the user that he should not enter the '%' character (we have lots of errors on Nemo log)

        Attachments

          Activity

            People

            Assignee:
            julien.lancelot Julien Lancelot
            Reporter:
            fabemn OLD - Fabrice Bellingard
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Due:
              Created:
              Updated:
              Resolved: