aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine
diff options
context:
space:
mode:
authorJanos Gyerik <janos.gyerik@sonarsource.com>2017-03-02 18:05:15 +0100
committerJanos Gyerik <janos.gyerik@sonarsource.com>2017-03-02 18:05:15 +0100
commitc946c2174c56c7c0463292c5a94e1d542950e028 (patch)
tree3157b5c741191d57426d6526aaa36ff3ff4998a5 /sonar-scanner-engine
parentbc298f995099795d8b280baa80eb579096dfcecb (diff)
downloadsonarqube-c946c2174c56c7c0463292c5a94e1d542950e028.tar.gz
sonarqube-c946c2174c56c7c0463292c5a94e1d542950e028.zip
Store repeated call result in local variable
Diffstat (limited to 'sonar-scanner-engine')
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/InputComponentStore.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/InputComponentStore.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/InputComponentStore.java
index 52c0167d100..ff92762a405 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/InputComponentStore.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/InputComponentStore.java
@@ -186,13 +186,14 @@ public class InputComponentStore {
}
public void put(DefaultInputModule inputModule) {
- Preconditions.checkState(!inputComponents.containsKey(inputModule.key()), "Module '%s' already indexed", inputModule.key());
- Preconditions.checkState(!inputModuleCache.containsKey(inputModule.key()), "Module '%s' already indexed", inputModule.key());
- inputComponents.put(inputModule.key(), inputModule);
- inputModuleCache.put(inputModule.key(), inputModule);
+ String key = inputModule.key();
+ Preconditions.checkState(!inputComponents.containsKey(key), "Module '%s' already indexed", key);
+ Preconditions.checkState(!inputModuleCache.containsKey(key), "Module '%s' already indexed", key);
+ inputComponents.put(key, inputModule);
+ inputModuleCache.put(key, inputModule);
if (inputModule.definition().getParent() == null) {
if (root != null) {
- throw new IllegalStateException("Root module already indexed: '" + root.key() + "', '" + inputModule.key() + "'");
+ throw new IllegalStateException("Root module already indexed: '" + root.key() + "', '" + key + "'");
}
root = inputModule;
}