diff options
author | Jean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com> | 2013-04-12 11:30:52 +0200 |
---|---|---|
committer | Jean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com> | 2013-04-12 11:30:52 +0200 |
commit | 33de62493fea3eb7517944ce50b760baba9be2cf (patch) | |
tree | c3cd2044f99e3664915bd830c161bb8d0257ed11 /sonar-batch | |
parent | 9f42fb95a0d3ff069f72bdd94de1ab1c2e9d771f (diff) | |
download | sonarqube-33de62493fea3eb7517944ce50b760baba9be2cf.tar.gz sonarqube-33de62493fea3eb7517944ce50b760baba9be2cf.zip |
SONAR-3893 Removed deprecated Highlightable API
Diffstat (limited to 'sonar-batch')
3 files changed, 9 insertions, 23 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/source/DefaultHighlightable.java b/sonar-batch/src/main/java/org/sonar/batch/scan/source/DefaultHighlightable.java index 75f10268870..f4a97278c38 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/source/DefaultHighlightable.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/source/DefaultHighlightable.java @@ -43,11 +43,6 @@ public class DefaultHighlightable implements Highlightable { } @Override - public void highlightText(int startOffset, int endOffset, String typeOfText) { - highlightingRulesBuilder.registerHighlightingRule(startOffset, endOffset, typeOfText); - } - - @Override public Component component() { return component; } diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/source/SyntaxHighlightingPersister.java b/sonar-batch/src/main/java/org/sonar/batch/scan/source/SyntaxHighlightingPersister.java index fd3d016e339..e852454671d 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/source/SyntaxHighlightingPersister.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/source/SyntaxHighlightingPersister.java @@ -47,17 +47,18 @@ public class SyntaxHighlightingPersister implements ScanPersister { Map<String, String> highlightingRules = highlightingCache.getHighlightingRulesByComponent(); - for (String component : highlightingRules.keySet()) { + for (Map.Entry<String, String> componentRules : highlightingRules.entrySet()) { - Snapshot snapshotForComponent = snapshots.get(component); + Snapshot snapshotForComponent = snapshots.get(componentRules.getKey()); SnapshotDataDto snapshotDataDto = new SnapshotDataDto(); - snapshotDataDto.setSnapshotId(snapshotForComponent.getId()); - snapshotDataDto.setResourceId(snapshotForComponent.getResourceId()); - snapshotDataDto.setDataType(DATA_TYPE); - snapshotDataDto.setData(highlightingRules.get(component)); - - snapshotDataDao.insert(snapshotDataDto); + if(snapshotForComponent != null) { + snapshotDataDto.setSnapshotId(snapshotForComponent.getId()); + snapshotDataDto.setResourceId(snapshotForComponent.getResourceId()); + snapshotDataDto.setDataType(DATA_TYPE); + snapshotDataDto.setData(highlightingRules.get(componentRules.getValue())); + snapshotDataDao.insert(snapshotDataDto); + } } } } diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/source/DefaultHighlightableTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/source/DefaultHighlightableTest.java index 476252b703d..d6fdaa44bb5 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/scan/source/DefaultHighlightableTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/scan/source/DefaultHighlightableTest.java @@ -35,16 +35,6 @@ public class DefaultHighlightableTest { public ExpectedException throwable = ExpectedException.none(); @Test - public void should_register_highlighting_rule() throws Exception { - - DefaultHighlightable highlightable = new DefaultHighlightable(null, null); - highlightable.highlightText(1, 10, "k"); - - assertThat(highlightable.getHighlightingRules().getSyntaxHighlightingRuleSet()).hasSize(1); - } - - - @Test public void should_store_highlighting_rules() throws Exception { DefaultHighlightable highlightablePerspective = new DefaultHighlightable(null, null); |