From: Julien Lancelot Date: Fri, 23 Aug 2013 07:59:42 +0000 (+0200) Subject: SONAR-4583 SONAR-4559 When rule name or description is null, display an empty String... X-Git-Tag: 3.7.1-RC1-~55 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=cbf751304cb0adaac15d4d9bc88c2b3e4faab997;p=sonarqube.git SONAR-4583 SONAR-4559 When rule name or description is null, display an empty String to prevent error with nil:NilClass preventing rendering the page --- diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb index 489955ea0a9..1b00e9010ff 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb @@ -107,6 +107,9 @@ class Rule < ActiveRecord::Base begin result = Java::OrgSonarServerUi::JRubyFacade.getInstance().getRuleName(I18n.locale, repository_key, plugin_rule_key) result = read_attribute(:name) unless result + # SONAR-4583 + # name should return an empty string instead of nil + result = '' unless result result end else @@ -115,6 +118,9 @@ class Rule < ActiveRecord::Base result = Java::OrgSonarServerUi::JRubyFacade.getInstance().getRuleName("en", repository_key, plugin_rule_key) # if no name present in the bundle, try to find it in the DB result = read_attribute(:name) unless result + # SONAR-4583 + # name should return an empty string instead of nil + result = '' unless result result end end @@ -129,6 +135,9 @@ class Rule < ActiveRecord::Base begin result = Java::OrgSonarServerUi::JRubyFacade.getInstance().getRuleDescription(I18n.locale, repository_key, plugin_rule_key) result = read_attribute(:description) unless result + # SONAR-4583 + # description should return an empty string instead of nil + result = '' unless result result end end