aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-webserver-auth/src
diff options
context:
space:
mode:
authorPierre <pierre.guillot@sonarsource.com>2020-12-08 13:01:37 +0100
committersonartech <sonartech@sonarsource.com>2020-12-09 20:07:21 +0000
commit2ac64829407349d696108c9d09c70d7ea2ad266a (patch)
tree8ac9725c0d669fa1187935726960c613b6352e15 /server/sonar-webserver-auth/src
parentfc6b79aaba37e38c01a5cac7d061b401a17947f8 (diff)
downloadsonarqube-2ac64829407349d696108c9d09c70d7ea2ad266a.tar.gz
sonarqube-2ac64829407349d696108c9d09c70d7ea2ad266a.zip
remove use of Stream.peek()
Diffstat (limited to 'server/sonar-webserver-auth/src')
-rw-r--r--server/sonar-webserver-auth/src/main/java/org/sonar/server/qualityprofile/BuiltInQProfileInsertImpl.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/qualityprofile/BuiltInQProfileInsertImpl.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/qualityprofile/BuiltInQProfileInsertImpl.java
index 8c3b290b79e..5b368c40f91 100644
--- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/qualityprofile/BuiltInQProfileInsertImpl.java
+++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/qualityprofile/BuiltInQProfileInsertImpl.java
@@ -20,6 +20,7 @@
package org.sonar.server.qualityprofile;
import com.google.common.base.Splitter;
+import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import java.util.Collections;
@@ -156,15 +157,14 @@ public class BuiltInQProfileInsertImpl implements BuiltInQProfileInsert {
Map<String, String> valuesByParamKey = activeRule.getParams()
.stream()
.collect(MoreCollectors.uniqueIndex(BuiltInQualityProfilesDefinition.OverriddenParam::key, BuiltInQualityProfilesDefinition.OverriddenParam::overriddenValue));
- return ruleRepository.getRuleParams(activeRule.getRuleKey())
+ List<ActiveRuleParamDto> rules = ruleRepository.getRuleParams(activeRule.getRuleKey())
.stream()
- .map(param -> {
- String activeRuleValue = valuesByParamKey.get(param.getName());
- return createParamDto(param, activeRuleValue == null ? param.getDefaultValue() : activeRuleValue);
- })
+ .map(param -> createParamDto(param, Optional.ofNullable(valuesByParamKey.get(param.getName())).orElse(param.getDefaultValue())))
.filter(Objects::nonNull)
- .peek(paramDto -> dbClient.activeRuleDao().insertParam(session, activeRuleDto, paramDto))
- .collect(MoreCollectors.toList());
+ .collect(Collectors.toList());
+
+ rules.forEach(paramDto -> dbClient.activeRuleDao().insertParam(session, activeRuleDto, paramDto));
+ return rules;
}
@CheckForNull