]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7676 fix cast error calling java_facade.saveProperty 1258/head
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Thu, 15 Sep 2016 12:19:56 +0000 (14:19 +0200)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Fri, 16 Sep 2016 09:31:45 +0000 (11:31 +0200)
server/sonar-web/src/main/webapp/WEB-INF/app/controllers/account_controller.rb
server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/properties_controller.rb
server/sonar-web/src/main/webapp/WEB-INF/app/models/property.rb

index d3bb3d70cad40d46d4db85ef7351a98f679448c1..8e8fee2d57f4002df5311881e63f5ceafce2cb9d 100644 (file)
@@ -54,7 +54,7 @@ class AccountController < ApplicationController
       project_notifs.each do |r_id, per_project_notif|
         per_project_notif.each do |dispatch, channels|
           channels.each do |channel, value|
-            Api::Utils.java_facade.saveProperty('notification.' + dispatch + '.' + channel, r_id, current_user.id, 'true')
+            Api::Utils.java_facade.saveProperty('notification.' + dispatch + '.' + channel, r_id.to_i, current_user.id, 'true')
           end
         end
       end
index 1be65ebedbafde155a20fd51dfde8816ccab9db2..9971150b7b18fde8f606be93d8d32ac0af55f0a8 100644 (file)
@@ -135,7 +135,7 @@ class Api::PropertiesController < Api::ApiController
         not_found('resource not found')
       end
     end
-    Api::Utils.java_facade.saveProperty(key, resource_id_or_key, nil, nil)
+    Api::Utils.java_facade.saveProperty(key, resource_id_or_key.nil? ? nil : resource_id_or_key.to_i, nil, nil)
     render_success('property deleted')
   end
 
index 225896f3129c53e183990821fcf8e9e11acad75d..ed1b86f2b18989c3a82935d0e8bb63349b3c8b7b 100644 (file)
@@ -55,7 +55,7 @@ class Property < ActiveRecord::Base
   def self.clear(key, resource_id=nil, user_id=nil)
     prop = by_key(key, resource_id, user_id)
     if prop
-      Api::Utils.java_facade.saveProperty(key, resource_id, user_id, nil)
+      Api::Utils.java_facade.saveProperty(key, resource_id.nil? ? nil : resource_id.to_i, user_id, nil)
     end
     prop
   end
@@ -124,7 +124,7 @@ class Property < ActiveRecord::Base
     end
 
     # create/update property in DB
-    Api::Utils.java_facade.saveProperty(key, resource_id, user_id, raw_value)
+    Api::Utils.java_facade.saveProperty(key, resource_id.nil? ? nil : resource_id.to_i, user_id, raw_value)
 
     # update returned property
     if raw_value.nil?