]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2268 Do not save invalid parameters for rules
authorEvgeny Mandrikov <mandrikov@gmail.com>
Mon, 6 Jun 2011 09:44:12 +0000 (13:44 +0400)
committerEvgeny Mandrikov <mandrikov@gmail.com>
Mon, 6 Jun 2011 10:41:50 +0000 (14:41 +0400)
sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/models/active_rule_parameter.rb

index 4f108f13706ec41b2d92255e4ca9d3ef8b56cf91..d4d028f2c6070aeaabe72cc7c357d9144252ab3f 100644 (file)
@@ -297,10 +297,10 @@ class RulesConfigurationController < ApplicationController
         active_param = ActiveRuleParameter.new(:rules_parameter => rule_param, :active_rule => active_rule ) if active_param.nil?
         old_value = active_param.value
         active_param.value = value
-        active_param.save
-        active_param.valid?
-        active_param.reload
-        java_facade.ruleParamChanged(profile.id, active_rule.id, rule_param.name, old_value, value, current_user.name)
+        if active_param.save && active_param.valid?
+          active_param.reload
+          java_facade.ruleParamChanged(profile.id, active_rule.id, rule_param.name, old_value, value, current_user.name)
+        end
       elsif !active_param.nil?
         old_value = active_param.value
         active_param.destroy
index e517a949ce17394d26a98732cb7d786bb1770805..cbc762891331a6ee2cadad29517a43bf7ac9e949 100644 (file)
@@ -29,8 +29,8 @@
      rules_parameter
    end
 
-   def validate_on_update
-     rules_parameter.validate_value(value, errors, "value" )
+   def validate
+     rules_parameter.validate_value(value, errors, "value")
    end
 
    def copy