From 279bc1ab7d8163a67d4c8e6d17bb59de30a97b25 Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Fri, 13 Dec 2013 17:23:20 +0100 Subject: [PATCH] SONAR-4535 Fix issue when no warnings / infos --- .../org/sonar/server/qualityprofile/NewProfileResult.java | 7 +++++++ .../webapp/WEB-INF/app/controllers/profiles_controller.rb | 2 -- .../main/webapp/WEB-INF/app/views/profiles/index.html.erb | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/sonar-server/src/main/java/org/sonar/server/qualityprofile/NewProfileResult.java b/sonar-server/src/main/java/org/sonar/server/qualityprofile/NewProfileResult.java index 21ee8868813..0ba7a99a7bf 100644 --- a/sonar-server/src/main/java/org/sonar/server/qualityprofile/NewProfileResult.java +++ b/sonar-server/src/main/java/org/sonar/server/qualityprofile/NewProfileResult.java @@ -22,6 +22,8 @@ package org.sonar.server.qualityprofile; import java.util.List; +import static com.google.common.collect.Lists.newArrayList; + public class NewProfileResult { private List warnings; @@ -29,6 +31,11 @@ public class NewProfileResult { private QProfile profile; + public NewProfileResult() { + warnings = newArrayList(); + infos = newArrayList(); + } + public List warnings() { return warnings; } diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb index 149e7afbc1a..4e3d0b2ce7c 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb @@ -62,8 +62,6 @@ class ProfilesController < ApplicationController unless result.warnings.empty? flash[:warning] = result.warnings.to_a[0...4].join('
') end - - # TODO manage these exceptions at a higher level rescue Java::OrgSonarServerExceptions::ServerException => error flash[:error] = (error.getMessage ? error.getMessage : Api::Utils.message(error.l10nKey, :params => error.l10nParams.to_a)) if error.java_kind_of?(Java::OrgSonarServerExceptions::BadRequestException) && !error.errors.empty? diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb index 827a9d6e771..2d87322db48 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb @@ -21,7 +21,8 @@ <% if profiles_administrator? %> <% end %> -- 2.39.5