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

When there isn't any description or title available on a rule, a NullPointerException is thrown

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0
    • Component/s: Quality Profile
    • Labels:
      None

      Description

      Whereas we expect exception during server startup with a meaninful message, which clearly says which plugin and which rule has no title or description.

      For the information in Sonar 2.14-RC1 error when description not available looks like :

      2012.03.06 12:19:50 ERROR o.s.s.ui.JRubyFacade  Fail to render: http://localhost:9000/rules_configuration/index/4?searchtext=&plugins%5B%5D=cppcheck&priorities%5B%5D=&rule_status=&commit=Search
      undefined method `strip' for nil:NilClass
              On line #10 of app/views/rules_configuration/_rule_note.html.erb
      
          7: submit_note_update_button_id = "snub_" + rule.id.to_s
          8: %>
          9: <div id="<%= note_detail_div_id -%>">
          10: <% if rule.description.strip.start_with?('<p>') %>
          11: <%= rule.description %>
          12: <% else %>
          13: <p><%= rule.description %></p>
      
          app/views/rules_configuration/_rule_note.html.erb:10
          org/jruby/RubyKernel.java:2056:in `send'
          app/views/rules_configuration/_rule.html.erb:37
          org/jruby/RubyKernel.java:2056:in `send'
          app/views/rules_configuration/index.html.erb:116
          org/jruby/RubyArray.java:1602:in `each'
          app/views/rules_configuration/index.html.erb:112
          org/jruby/RubyKernel.java:2056:in `send'
          org/jruby/RubyKernel.java:2052:in `send'
          org/jruby/RubyProc.java:268:in `call'
          org/jruby/RubyProc.java:228:in `call'
          /tmp/sonar/tomcat6x/work/Catalina/localhost/_/loader/vendor/rack-1.2.1/rack/head.rb:9:in `call'
          /tmp/sonar/tomcat6x/work/Catalina/localhost/_/loader/vendor/rack-1.2.1/rack/methodoverride.rb:24:in `call'
          /tmp/sonar/tomcat6x/work/Catalina/localhost/_/loader/jruby/rack/session_store.rb:42:in `call'
          /tmp/sonar/tomcat6x/work/Catalina/localhost/_/loader/rack/adapter/rails.rb:36:in `serve_rails'
          /tmp/sonar/tomcat6x/work/Catalina/localhost/_/loader/rack/adapter/rails.rb:41:in `call'
          /tmp/sonar/tomcat6x/work/Catalina/localhost/_/loader/jruby/rack/rails.rb:185:in `call'
          /tmp/sonar/tomcat6x/work/Catalina/localhost/_/loader/rack/handler/servlet.rb:19:in `call'
      

      and when title not available :

      undefined method `downcase' for nil:NilClass
              /tmp/sonar/tomcat6x/temp/0-ROOT/WEB-INF/app/models/rule.rb:69:in `<=>'
              org/jruby/RubyArray.java:3242:in `sort!'
              org/jruby/RubyArray.java:3221:in `sort'
              /tmp/sonar/tomcat6x/temp/0-ROOT/WEB-INF/app/models/rule.rb:269:in `search'
              /tmp/sonar/tomcat6x/temp/0-ROOT/WEB-INF/app/controllers/rules_configuration_controller.rb:61:in `index'
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              fabemn OLD - Fabrice Bellingard
              Reporter:
              freddy.mallet Freddy Mallet (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: