From e05de07b50ae8fb4d86ba8f9fb8f6cf66a9095ae Mon Sep 17 00:00:00 2001 From: David Gageot Date: Tue, 29 May 2012 16:20:54 +0200 Subject: [PATCH] FIX violation --- .../server/startup/RegisterNewDashboards.java | 14 ++++++++++++-- 1 file 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()); -- 2.39.5