diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2015-04-16 11:04:39 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2015-04-17 09:00:57 +0200 |
commit | ae3b5f5b5128b07eaf8896cf9fc52b809ca7cb51 (patch) | |
tree | 9a63115220eb81c0551783593a426d4683e5653c /sonar-batch | |
parent | 35fc55bfc5b44020cf3e6a4c232531a1264ae6d0 (diff) | |
download | sonarqube-ae3b5f5b5128b07eaf8896cf9fc52b809ca7cb51.tar.gz sonarqube-ae3b5f5b5128b07eaf8896cf9fc52b809ca7cb51.zip |
SONAR-6258 Fix hashes, symbols and highlighting persistence
Diffstat (limited to 'sonar-batch')
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/index/SourcePersister.java | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/SourcePersister.java b/sonar-batch/src/main/java/org/sonar/batch/index/SourcePersister.java index d1defb7b7ca..55df774b4ce 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/SourcePersister.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/SourcePersister.java @@ -21,9 +21,6 @@ package org.sonar.batch.index; import org.apache.commons.codec.binary.Hex; import org.apache.commons.codec.digest.DigestUtils; -import org.apache.ibatis.session.ResultContext; -import org.apache.ibatis.session.ResultHandler; -import org.sonar.api.batch.fs.InputFile; import org.sonar.api.batch.fs.internal.DefaultInputFile; import org.sonar.api.batch.fs.internal.FileMetadata; import org.sonar.api.batch.fs.internal.FileMetadata.LineHashConsumer; @@ -39,7 +36,6 @@ import javax.annotation.CheckForNull; import javax.annotation.Nullable; import java.io.IOException; -import java.util.HashMap; import java.util.Map; public class SourcePersister implements ScanPersister { @@ -64,24 +60,24 @@ public class SourcePersister implements ScanPersister { @Override public void persist() { // Don't use batch insert for file_sources since keeping all data in memory can produce OOM for big files - try (DbSession session = mybatis.openSession(false)) { - - final Map<String, FileSourceDto> previousDtosByUuid = new HashMap<>(); - session.select("org.sonar.core.source.db.FileSourceMapper.selectHashesForProject", projectTree.getRootProject().getUuid(), new ResultHandler() { - @Override - public void handleResult(ResultContext context) { - FileSourceDto dto = (FileSourceDto) context.getResultObject(); - previousDtosByUuid.put(dto.getFileUuid(), dto); - } - }); - - FileSourceMapper mapper = session.getMapper(FileSourceMapper.class); - for (InputFile inputFile : inputPathCache.allFiles()) { - persist(session, mapper, (DefaultInputFile) inputFile, previousDtosByUuid); - } - } catch (Exception e) { - throw new IllegalStateException("Unable to save file sources", e); - } +// try (DbSession session = mybatis.openSession(false)) { +// +// final Map<String, FileSourceDto> previousDtosByUuid = new HashMap<>(); +// session.select("org.sonar.core.source.db.FileSourceMapper.selectHashesForProject", projectTree.getRootProject().getUuid(), new ResultHandler() { +// @Override +// public void handleResult(ResultContext context) { +// FileSourceDto dto = (FileSourceDto) context.getResultObject(); +// previousDtosByUuid.put(dto.getFileUuid(), dto); +// } +// }); +// +// FileSourceMapper mapper = session.getMapper(FileSourceMapper.class); +// for (InputFile inputFile : inputPathCache.allFiles()) { +// persist(session, mapper, (DefaultInputFile) inputFile, previousDtosByUuid); +// } +// } catch (Exception e) { +// throw new IllegalStateException("Unable to save file sources", e); +// } } |