From: Sébastien Lesaint Date: Thu, 15 Sep 2016 12:19:56 +0000 (+0200) Subject: SONAR-7676 fix cast error calling java_facade.saveProperty X-Git-Tag: 6.1-RC1~52 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F1258%2Fhead;p=sonarqube.git SONAR-7676 fix cast error calling java_facade.saveProperty --- diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/account_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/account_controller.rb index d3bb3d70cad..8e8fee2d57f 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/account_controller.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/account_controller.rb @@ -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 diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/properties_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/properties_controller.rb index 1be65ebedba..9971150b7b1 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/properties_controller.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/properties_controller.rb @@ -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 diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/models/property.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/models/property.rb index 225896f3129..ed1b86f2b18 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/models/property.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/models/property.rb @@ -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?