diff options
Diffstat (limited to 'server/sonar-db-dao/src/main/java')
3 files changed, 5 insertions, 12 deletions
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java b/server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java index cc088c10d12..12f3ab67d48 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java @@ -19,8 +19,6 @@ */ package org.sonar.db; -import java.util.Arrays; -import java.util.Collections; import java.util.List; import org.sonar.core.platform.Module; import org.sonar.db.alm.pat.AlmPatDao; @@ -59,8 +57,8 @@ import org.sonar.db.permission.template.PermissionTemplateCharacteristicDao; import org.sonar.db.permission.template.PermissionTemplateDao; import org.sonar.db.plugin.PluginDao; import org.sonar.db.portfolio.PortfolioDao; -import org.sonar.db.project.ProjectDao; import org.sonar.db.project.ProjectBadgeTokenDao; +import org.sonar.db.project.ProjectDao; import org.sonar.db.property.InternalComponentPropertiesDao; import org.sonar.db.property.InternalPropertiesDao; import org.sonar.db.property.PropertiesDao; @@ -95,7 +93,7 @@ import org.sonar.db.webhook.WebhookDao; import org.sonar.db.webhook.WebhookDeliveryDao; public class DaoModule extends Module { - private static final List<Class<? extends Dao>> classes = Collections.unmodifiableList(Arrays.asList( + private static final List<Class<? extends Dao>> classes = List.of( // ===================================================================== // for readability and easier merge, keep list ordered alphabetically // ===================================================================== @@ -168,7 +166,7 @@ public class DaoModule extends Module { UserPropertiesDao.class, UserTokenDao.class, WebhookDao.class, - WebhookDeliveryDao.class)); + WebhookDeliveryDao.class); @Override protected void configureModule() { diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/ce/CeTaskCharacteristicDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/ce/CeTaskCharacteristicDto.java index acf7f6783ee..75928668ec8 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/ce/CeTaskCharacteristicDto.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/ce/CeTaskCharacteristicDto.java @@ -30,7 +30,7 @@ public class CeTaskCharacteristicDto { public static final String BRANCH_KEY = "branch"; public static final String BRANCH_TYPE_KEY = "branchType"; public static final String PULL_REQUEST = "pullRequest"; - public static final Set<String> SUPPORTED_KEYS = unmodifiableSet(new HashSet<>(asList(BRANCH_KEY, BRANCH_TYPE_KEY, PULL_REQUEST))); + public static final Set<String> SUPPORTED_KEYS = Set.of(BRANCH_KEY, BRANCH_TYPE_KEY, PULL_REQUEST); private String uuid; private String taskUuid; diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeProfiler.java b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeProfiler.java index 9d0a8250173..ec1e3ff7828 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeProfiler.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeProfiler.java @@ -55,12 +55,7 @@ public class PurgeProfiler { } void stop() { - final Long cumulatedDuration; - if (durations.containsKey(currentTable)) { - cumulatedDuration = durations.get(currentTable); - } else { - cumulatedDuration = 0L; - } + Long cumulatedDuration = durations.getOrDefault(currentTable, 0L); durations.put(currentTable, cumulatedDuration + (clock.now() - startTime)); } |