aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-webserver-core/src
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2022-04-28 16:22:34 -0500
committersonartech <sonartech@sonarsource.com>2022-05-25 20:03:15 +0000
commitc28353ec8b036b74bb070ca03420bfea29b1ca8d (patch)
tree497cfdff35c4a4bea3713b9c4001b28105ab8834 /server/sonar-webserver-core/src
parent251e1fa5c7bb38ce93dc426ae2e395d44819f721 (diff)
downloadsonarqube-c28353ec8b036b74bb070ca03420bfea29b1ca8d.tar.gz
sonarqube-c28353ec8b036b74bb070ca03420bfea29b1ca8d.zip
SONAR-16316 DAO to fetch report issues from DB
SONAR-16316 Export CSV files with issues SONAR-16316 Create Web API 'api/regulatory_reports/download' SONAR-16316 Export Scanner Context SONAR-16316 Write report zip file SONAR-16316 Integrate pdf report in zip file
Diffstat (limited to 'server/sonar-webserver-core/src')
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/SettingsSection.java14
1 files changed, 5 insertions, 9 deletions
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/SettingsSection.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/SettingsSection.java
index 8c87854b66a..9bf64d642ad 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/SettingsSection.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/SettingsSection.java
@@ -77,7 +77,7 @@ public class SettingsSection implements SystemInfoSection, Global {
private void addDefaultNewCodeDefinition(Builder protobuf) {
try (DbSession dbSession = dbClient.openSession(false)) {
Optional<NewCodePeriodDto> period = dbClient.newCodePeriodDao().selectGlobal(dbSession);
- setAttribute(protobuf, "Default New Code Definition", parseDefaultNewCodeDefinition(period));
+ setAttribute(protobuf, "Default New Code Definition", parseDefaultNewCodeDefinition(period.orElse(NewCodePeriodDto.defaultInstance())));
}
}
@@ -95,15 +95,11 @@ public class SettingsSection implements SystemInfoSection, Global {
return abbreviate(value, MAX_VALUE_LENGTH);
}
- private static String parseDefaultNewCodeDefinition(Optional<NewCodePeriodDto> period) {
- if (!period.isPresent()) {
- return "PREVIOUS_VERSION";
+ private static String parseDefaultNewCodeDefinition(NewCodePeriodDto period) {
+ if (period.getValue() == null) {
+ return period.getType().name();
}
- if (period.get().getValue() == null) {
- return period.get().getType().name();
- }
-
- return period.get().getType().name() + ": " + period.get().getValue();
+ return period.getType().name() + ": " + period.getValue();
}
}