diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2017-09-06 11:09:20 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2017-09-06 11:09:20 +0200 |
commit | 24afdb04fb172ef2ff3fe23760513fc16e42e42a (patch) | |
tree | 7d6f01ff74f7833342b1db4933a41d1101bb26de /sonar-scanner-protocol | |
parent | b793d3a80995b0fc008c33b37bc6304cf06426ec (diff) | |
download | sonarqube-24afdb04fb172ef2ff3fe23760513fc16e42e42a.tar.gz sonarqube-24afdb04fb172ef2ff3fe23760513fc16e42e42a.zip |
Fix quality flaws
Diffstat (limited to 'sonar-scanner-protocol')
-rw-r--r-- | sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/input/ProjectRepositories.java | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/input/ProjectRepositories.java b/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/input/ProjectRepositories.java index ce1a0575995..36dbde468cc 100644 --- a/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/input/ProjectRepositories.java +++ b/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/input/ProjectRepositories.java @@ -48,11 +48,7 @@ public class ProjectRepositories { } public ProjectRepositories addSettings(String moduleKey, Map<String, String> settings) { - Map<String, String> existingSettings = settingsByModule.get(moduleKey); - if (existingSettings == null) { - existingSettings = new HashMap<>(); - settingsByModule.put(moduleKey, existingSettings); - } + Map<String, String> existingSettings = settingsByModule.computeIfAbsent(moduleKey, k -> new HashMap<>()); existingSettings.putAll(settings); return this; } @@ -74,11 +70,7 @@ public class ProjectRepositories { return this; } - Map<String, FileData> existingFileDataByPath = fileDataByModuleAndPath.get(moduleKey); - if (existingFileDataByPath == null) { - existingFileDataByPath = new HashMap<>(); - fileDataByModuleAndPath.put(moduleKey, existingFileDataByPath); - } + Map<String, FileData> existingFileDataByPath = fileDataByModuleAndPath.computeIfAbsent(moduleKey, k -> new HashMap<>()); existingFileDataByPath.put(path, fileData); return this; } |