summaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2012-01-11 11:37:51 +0400
committerEvgeny Mandrikov <mandrikov@gmail.com>2012-01-11 11:38:31 +0400
commit914e20ebb7bf1f12ec2c2d838e5169d8a31ce345 (patch)
tree80c16ec0180540a6eedc722caf5d6cf5e1e81173 /sonar-server
parentda0d012b993ba4ddc8cddfb9e7aeb6fac1af6168 (diff)
downloadsonarqube-914e20ebb7bf1f12ec2c2d838e5169d8a31ce345.tar.gz
sonarqube-914e20ebb7bf1f12ec2c2d838e5169d8a31ce345.zip
SONAR-3137 Add exception handling
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/lib/need_authentication.rb23
1 files changed, 16 insertions, 7 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/lib/need_authentication.rb b/sonar-server/src/main/webapp/WEB-INF/lib/need_authentication.rb
index 8ad97b1ceb4..94e7d62223d 100644
--- a/sonar-server/src/main/webapp/WEB-INF/lib/need_authentication.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/lib/need_authentication.rb
@@ -49,9 +49,12 @@ class PluginRealm
def authenticate?(login, password)
return false if login.blank? || password.blank?
- # TODO handle exceptions
- if @java_authenticator.authenticate(login, password)
- return true
+ begin
+ if @java_authenticator.authenticate(login, password)
+ return true
+ end
+ rescue Exception => e
+ Java::OrgSonarServerUi::JRubyFacade.new.logError("Error from external authenticator: #{e.message}")
end
# Fallback to password from Sonar Database
user = User.find_by_login(login)
@@ -60,10 +63,16 @@ class PluginRealm
def synchronize(user, password)
if @java_users_provider
- # TODO handle exceptions
- details = @java_users_provider.doGetUserDetails(user.login)
- user.update_attributes(:name => details.getName(), :email => details.getEmail(), :password => password, :password_confirmation => password)
- user.save
+ begin
+ details = @java_users_provider.doGetUserDetails(user.login)
+ rescue Exception => e
+ Java::OrgSonarServerUi::JRubyFacade.new.logError("Error from external users provider: #{e.message}")
+ else
+ if details
+ user.update_attributes(:name => details.getName(), :email => details.getEmail(), :password => password, :password_confirmation => password)
+ user.save
+ end
+ end
end
end