diff options
author | David Gageot <david@gageot.net> | 2012-05-29 16:20:54 +0200 |
---|---|---|
committer | David Gageot <david@gageot.net> | 2012-05-29 16:20:54 +0200 |
commit | e05de07b50ae8fb4d86ba8f9fb8f6cf66a9095ae (patch) | |
tree | d6641390d5fa7f93da0421f90e1234b7bbd0386a | |
parent | c4bfe32904367d963cd352a2b7c18ded34dfb4e9 (diff) | |
download | sonarqube-e05de07b50ae8fb4d86ba8f9fb8f6cf66a9095ae.tar.gz sonarqube-e05de07b50ae8fb4d86ba8f9fb8f6cf66a9095ae.zip |
FIX violation
-rw-r--r-- | sonar-server/src/main/java/org/sonar/server/startup/RegisterNewDashboards.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/startup/RegisterNewDashboards.java b/sonar-server/src/main/java/org/sonar/server/startup/RegisterNewDashboards.java index 4bdf52b9ad9..6f7b924032e 100644 --- a/sonar-server/src/main/java/org/sonar/server/startup/RegisterNewDashboards.java +++ b/sonar-server/src/main/java/org/sonar/server/startup/RegisterNewDashboards.java @@ -152,11 +152,21 @@ public final class RegisterNewDashboards { @Override public int compare(DashboardDto d1, DashboardDto d2) { + if ((d1 == null) && (d2 == null)) { + return 0; + } + if ((d1 == null) || (d1.getName() == null)) { + return +1; + } + if ((d2 == null) || (d2.getName() == null)) { + return -1; + } + // the default dashboard must be the first one to be activated - if (d1.getName().equals(DEFAULT_DASHBOARD_NAME)) { + if (DEFAULT_DASHBOARD_NAME.equals(d1.getName())) { return -1; } - if (d2.getName().equals(DEFAULT_DASHBOARD_NAME)) { + if (DEFAULT_DASHBOARD_NAME.equals(d2.getName())) { return 1; } return d1.getName().compareTo(d2.getName()); |