aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core/src/main
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2012-01-24 17:17:59 +0400
committerEvgeny Mandrikov <mandrikov@gmail.com>2012-01-24 20:33:39 +0400
commited409e8f0a53554aad46ac438b93b7adc02cc5d8 (patch)
treeaf3c6337ef286c9cd4b68b490b43994fbc78a32a /sonar-core/src/main
parent74ae0f80835d5b236480b78253ed9a30af56ca6a (diff)
downloadsonarqube-ed409e8f0a53554aad46ac438b93b7adc02cc5d8.tar.gz
sonarqube-ed409e8f0a53554aad46ac438b93b7adc02cc5d8.zip
SONAR-3181,SONAR-3139 Enable cross project CPD for all languages
sonar.cpd.minimumTokens can't be used, because for index in database tokens must be grouped by lines.
Diffstat (limited to 'sonar-core/src/main')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/duplication/DuplicationDao.java4
-rw-r--r--sonar-core/src/main/java/org/sonar/core/duplication/DuplicationMapper.java3
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/duplication/DuplicationMapper.xml1
3 files changed, 5 insertions, 3 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/duplication/DuplicationDao.java b/sonar-core/src/main/java/org/sonar/core/duplication/DuplicationDao.java
index 2d98f947ca8..e557d061ca7 100644
--- a/sonar-core/src/main/java/org/sonar/core/duplication/DuplicationDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/duplication/DuplicationDao.java
@@ -36,11 +36,11 @@ public class DuplicationDao implements BatchComponent, ServerComponent {
this.mybatis = mybatis;
}
- public List<DuplicationUnitDto> selectCandidates(int resourceSnapshotId, Integer lastSnapshotId) {
+ public List<DuplicationUnitDto> selectCandidates(int resourceSnapshotId, Integer lastSnapshotId, String language) {
SqlSession session = mybatis.openSession();
try {
DuplicationMapper mapper = session.getMapper(DuplicationMapper.class);
- return mapper.selectCandidates(resourceSnapshotId, lastSnapshotId);
+ return mapper.selectCandidates(resourceSnapshotId, lastSnapshotId, language);
} finally {
MyBatis.closeSessionQuietly(session);
}
diff --git a/sonar-core/src/main/java/org/sonar/core/duplication/DuplicationMapper.java b/sonar-core/src/main/java/org/sonar/core/duplication/DuplicationMapper.java
index fa4b30052cb..f7afbb79af4 100644
--- a/sonar-core/src/main/java/org/sonar/core/duplication/DuplicationMapper.java
+++ b/sonar-core/src/main/java/org/sonar/core/duplication/DuplicationMapper.java
@@ -27,7 +27,8 @@ public interface DuplicationMapper {
List<DuplicationUnitDto> selectCandidates(
@Param("resource_snapshot_id") int resourceSnapshotId,
- @Param("last_project_snapshot_id") Integer lastSnapshotId);
+ @Param("last_project_snapshot_id") Integer lastSnapshotId,
+ @Param("language") String language);
void batchInsert(DuplicationUnitDto unit);
diff --git a/sonar-core/src/main/resources/org/sonar/core/duplication/DuplicationMapper.xml b/sonar-core/src/main/resources/org/sonar/core/duplication/DuplicationMapper.xml
index c1dc43121e4..2f0af1b57e7 100644
--- a/sonar-core/src/main/resources/org/sonar/core/duplication/DuplicationMapper.xml
+++ b/sonar-core/src/main/resources/org/sonar/core/duplication/DuplicationMapper.xml
@@ -11,6 +11,7 @@
AND to_blocks.snapshot_id = snapshot.id
AND snapshot.islast = ${_true}
AND snapshot.project_id = res.id
+ AND res.language = #{language}
<if test="last_project_snapshot_id != null">
AND to_blocks.project_snapshot_id != #{last_project_snapshot_id}
</if>