From bedbb8c52bff124c9e1ab33d3e7b16a1270990a2 Mon Sep 17 00:00:00 2001 From: Duarte Meneses Date: Thu, 25 May 2023 12:04:41 -0500 Subject: [PATCH] SONAR-18856 Fix SonarQube issues and BTT --- .../java/org/sonar/db/entity/EntityDto.java | 1 - .../org/sonar/db/project/ProjectMapper.java | 2 -- .../version/v101/PopulateReportSchedules.java | 1 - .../sonar/server/setting/ws/SetActionIT.java | 22 +++++++++---------- .../sonar/server/favorite/FavoriteFinder.java | 2 +- .../sonar/server/setting/ws/ResetAction.java | 4 ++-- 6 files changed, 14 insertions(+), 18 deletions(-) diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/entity/EntityDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/entity/EntityDto.java index aa031c0787a..03e0b564dc3 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/entity/EntityDto.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/entity/EntityDto.java @@ -20,7 +20,6 @@ package org.sonar.db.entity; import java.util.Objects; -import javax.annotation.CheckForNull; /** * Represents a project, an application, a portfolio or a sub-portfolio. diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/project/ProjectMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/project/ProjectMapper.java index c4ddb661141..d778d860e42 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/project/ProjectMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/project/ProjectMapper.java @@ -25,8 +25,6 @@ import java.util.Set; import javax.annotation.CheckForNull; import javax.annotation.Nullable; import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.session.ResultHandler; -import org.sonar.db.entity.EntityDto; public interface ProjectMapper { diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v101/PopulateReportSchedules.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v101/PopulateReportSchedules.java index d0510efcb2e..46d9d088439 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v101/PopulateReportSchedules.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v101/PopulateReportSchedules.java @@ -20,7 +20,6 @@ package org.sonar.server.platform.db.migration.version.v101; import java.sql.SQLException; -import org.sonar.core.util.UuidFactory; import org.sonar.core.util.UuidFactoryImpl; import org.sonar.db.Database; import org.sonar.server.platform.db.migration.step.DataChange; diff --git a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/setting/ws/SetActionIT.java b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/setting/ws/SetActionIT.java index 44caee87e40..aecbf1c0fc4 100644 --- a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/setting/ws/SetActionIT.java +++ b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/setting/ws/SetActionIT.java @@ -82,17 +82,17 @@ public class SetActionIT { @Rule public DbTester db = DbTester.create(System2.INSTANCE); - private PropertyDbTester propertyDb = new PropertyDbTester(db); - private DbClient dbClient = db.getDbClient(); - private DbSession dbSession = db.getSession(); - private I18nRule i18n = new I18nRule(); - private PropertyDefinitions definitions = new PropertyDefinitions(System2.INSTANCE); - private FakeSettingsNotifier settingsChangeNotifier = new FakeSettingsNotifier(dbClient); - private SettingsUpdater settingsUpdater = new SettingsUpdater(dbClient, definitions); - private SettingValidations validations = new SettingValidations(definitions, dbClient, i18n); - private SetAction underTest = new SetAction(definitions, dbClient, userSession, settingsUpdater, settingsChangeNotifier, validations); - - private WsActionTester ws = new WsActionTester(underTest); + private final PropertyDbTester propertyDb = new PropertyDbTester(db); + private final DbClient dbClient = db.getDbClient(); + private final DbSession dbSession = db.getSession(); + private final I18nRule i18n = new I18nRule(); + private final PropertyDefinitions definitions = new PropertyDefinitions(System2.INSTANCE); + private final FakeSettingsNotifier settingsChangeNotifier = new FakeSettingsNotifier(dbClient); + private final SettingsUpdater settingsUpdater = new SettingsUpdater(dbClient, definitions); + private final SettingValidations validations = new SettingValidations(definitions, dbClient, i18n); + private final SetAction underTest = new SetAction(definitions, dbClient, userSession, settingsUpdater, settingsChangeNotifier, validations); + + private final WsActionTester ws = new WsActionTester(underTest); @Before public void setUp() { diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/favorite/FavoriteFinder.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/favorite/FavoriteFinder.java index f4ff21dc83f..0f06eeac101 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/favorite/FavoriteFinder.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/favorite/FavoriteFinder.java @@ -61,7 +61,7 @@ public class FavoriteFinder { return entities.stream() .sorted(Comparator.comparing(EntityDto::getName)) - .collect(Collectors.toList()); + .toList(); } } } diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/setting/ws/ResetAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/setting/ws/ResetAction.java index b66b6dbaad4..aad5e3124a3 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/setting/ws/ResetAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/setting/ws/ResetAction.java @@ -147,8 +147,8 @@ public class ResetAction implements SettingsWsAction { } private static class ResetRequest { - private String entity; - private List keys; + private String entity = null; + private List keys = null; public ResetRequest setEntity(@Nullable String entity) { this.entity = entity; -- 2.39.5