From cbf751304cb0adaac15d4d9bc88c2b3e4faab997 Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Fri, 23 Aug 2013 09:59:42 +0200 Subject: [PATCH] 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 --- sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb | 9 +++++++++ 1 file changed, 9 insertions(+) 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 -- 2.39.5