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

Numeric and boolean properties should allow space in values

    XMLWordPrintable

    Details

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

      Description

      Reading a numeric or boolean property, for example from sonar.properties, fails when value contains a whitespace.

      Example: "sonar.search.rules.shards=15 "

      Error is:

      2017.05.17 16:38:55 ERROR web[][o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
      java.lang.NumberFormatException: For input string: "15  "
      	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
      	at java.lang.Integer.parseInt(Integer.java:580)
      	at java.lang.Integer.parseInt(Integer.java:615)
      	at org.sonar.api.config.Settings.getInt(Settings.java:225)
      	at org.sonar.server.es.NewIndex.configureShards(NewIndex.java:82)
      	at org.sonar.server.rule.index.RuleIndexDefinition.define(RuleIndexDefinition.java:95)
      	at org.sonar.server.es.IndexDefinitions.start(IndexDefinitions.java:108)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      

      Solution: the component org.sonar.api.config.Settings should trim string values before converting to number or boolean. See methods "getXxx()" like getInt(String).

        Attachments

          Activity

            People

            Assignee:
            sebastien.lesaint Sebastien Lesaint
            Reporter:
            simon.brandhof Simon Brandhof (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Due:
              Created:
              Updated:
              Resolved: