diff options
author | Matteo Mara <matteo.mara@sonarsource.com> | 2024-01-19 09:16:24 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-01-19 20:02:55 +0000 |
commit | 7cd10abfe6c27bcd08a182da07b06502e316de25 (patch) | |
tree | bae23a7dbb1ec1ee09df376d62c48c2ef8599cd1 /sonar-scanner-engine/src/main/java | |
parent | 75852932c6de4610bf9772b23dbf0fe12a773f28 (diff) | |
download | sonarqube-7cd10abfe6c27bcd08a182da07b06502e316de25.tar.gz sonarqube-7cd10abfe6c27bcd08a182da07b06502e316de25.zip |
SONAR-21195 Handle correctly .file.suffixes properties when their deprecated key is used
Diffstat (limited to 'sonar-scanner-engine/src/main/java')
-rw-r--r-- | sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/SonarGlobalPropertiesFilter.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/SonarGlobalPropertiesFilter.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/SonarGlobalPropertiesFilter.java index 87242ac21b4..1f5b94fd42d 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/SonarGlobalPropertiesFilter.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/SonarGlobalPropertiesFilter.java @@ -20,6 +20,7 @@ package org.sonar.scanner.scan; import com.google.common.annotations.VisibleForTesting; +import java.util.LinkedHashMap; import java.util.Map; import java.util.stream.Collectors; @@ -36,10 +37,15 @@ public class SonarGlobalPropertiesFilter { private static Map<String, String> getNonSonarGlobalProperties(Map<String, String> settingProperties) { - return settingProperties.entrySet() - .stream() - .filter(entry -> !isSonarGlobalProperty(entry.getKey())) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); + // Using a LinkedHashMap because the order of the entries in the settings map is important for properly converting + // deprecated properties to their correct value. + Map<String, String> nonSonarGlobalProperties = new LinkedHashMap<>(); + settingProperties.forEach((key, value) -> { + if (!isSonarGlobalProperty(key)) { + nonSonarGlobalProperties.put(key, value); + } + }); + return nonSonarGlobalProperties; } private static Map<String, String> getSonarGlobalProperties(Map<String, String> properties) { |