From 9ce1f45d9d72e66a68c0614847b813a2e55d77b2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Lesaint?= Date: Thu, 15 Sep 2016 14:19:56 +0200 Subject: [PATCH] SONAR-7676 fix cast error calling java_facade.saveProperty --- .../main/webapp/WEB-INF/app/controllers/account_controller.rb | 2 +- .../WEB-INF/app/controllers/api/properties_controller.rb | 2 +- .../sonar-web/src/main/webapp/WEB-INF/app/models/property.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) 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? -- 2.39.5