executorService.shutdown();
}
}
private void populateIndex(String languageKey, List<InputFile> sourceFiles, CpdMapping mapping, SonarDuplicationsIndex index) {
TokenizerBridge bridge = null;
if (mapping != null) {
bridge = new TokenizerBridge(mapping.getTokenizer(), fs.encoding().name(), getBlockSize(languageKey));
}
for (InputFile inputFile : sourceFiles) {
LOG.debug("Populating index from {}", inputFile);
String resourceEffectiveKey = ((DeprecatedDefaultInputFile) inputFile).key();
FileBlocks fileBlocks = duplicationCache.byComponent(resourceEffectiveKey);
if (fileBlocks != null) {
index.insert(inputFile, fileBlocks.blocks());
} else if (bridge != null) {
List<Block> blocks2 = bridge.chunk(resourceEffectiveKey, inputFile.file());
index.insert(inputFile, blocks2);
}
}
}