aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-protocol/src
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2020-08-04 10:03:00 -0500
committersonartech <sonartech@sonarsource.com>2020-08-10 20:06:21 +0000
commite96686ffd551939bfc459cdd5b92c132feb213a6 (patch)
tree8544f089aaaf7e73d9209055acf9c71d8851983e /sonar-scanner-protocol/src
parent1ce932189af3fa26247863a12acf51f21b772acd (diff)
downloadsonarqube-e96686ffd551939bfc459cdd5b92c132feb213a6.tar.gz
sonarqube-e96686ffd551939bfc459cdd5b92c132feb213a6.zip
Fix scanner report viewer
Diffstat (limited to 'sonar-scanner-protocol/src')
-rw-r--r--sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java27
1 files changed, 14 insertions, 13 deletions
diff --git a/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java b/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java
index f185c909000..7349fa688f8 100644
--- a/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java
+++ b/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java
@@ -255,7 +255,7 @@ public class ScannerReportViewerApp {
try (CloseableIterator<ScannerReport.CpdTextBlock> it = reader.readCpdTextBlocks(component.getRef())) {
while (it.hasNext()) {
ScannerReport.CpdTextBlock textBlock = it.next();
- cpdTextBlocksEditor.getDocument().insertString(cpdTextBlocksEditor.getDocument().getEndPosition().getOffset(), textBlock + "\n", null);
+ cpdTextBlocksEditor.getDocument().insertString(cpdTextBlocksEditor.getDocument().getLength(), textBlock + "\n", null);
}
} catch (Exception e) {
throw new IllegalStateException("Can't read CPD text blocks for " + getNodeName(component), e);
@@ -270,7 +270,7 @@ public class ScannerReportViewerApp {
if (it != null) {
while (it.hasNext()) {
ScannerReport.LineSgnificantCode textBlock = it.next();
- significantCodeEditor.getDocument().insertString(significantCodeEditor.getDocument().getEndPosition().getOffset(), textBlock + "\n", null);
+ significantCodeEditor.getDocument().insertString(significantCodeEditor.getDocument().getLength(), textBlock + "\n", null);
}
}
} catch (Exception e) {
@@ -285,7 +285,7 @@ public class ScannerReportViewerApp {
try (CloseableIterator<ScannerReport.Duplication> it = reader.readComponentDuplications(component.getRef())) {
while (it.hasNext()) {
ScannerReport.Duplication dup = it.next();
- duplicationEditor.getDocument().insertString(duplicationEditor.getDocument().getEndPosition().getOffset(), dup + "\n", null);
+ duplicationEditor.getDocument().insertString(duplicationEditor.getDocument().getLength(), dup + "\n", null);
}
} catch (Exception e) {
throw new IllegalStateException("Can't read duplications for " + getNodeName(component), e);
@@ -298,7 +298,7 @@ public class ScannerReportViewerApp {
try (CloseableIterator<Issue> it = reader.readComponentIssues(component.getRef())) {
while (it.hasNext()) {
Issue issue = it.next();
- int offset = issuesEditor.getDocument().getEndPosition().getOffset();
+ int offset = issuesEditor.getDocument().getLength();
issuesEditor.getDocument().insertString(offset, issue.toString(), null);
}
} catch (Exception e) {
@@ -311,7 +311,7 @@ public class ScannerReportViewerApp {
try (CloseableIterator<ScannerReport.ExternalIssue> it = reader.readComponentExternalIssues(component.getRef())) {
while (it.hasNext()) {
ScannerReport.ExternalIssue issue = it.next();
- int offset = externalIssuesEditor.getDocument().getEndPosition().getOffset();
+ int offset = externalIssuesEditor.getDocument().getLength();
externalIssuesEditor.getDocument().insertString(offset, issue.toString(), null);
}
} catch (Exception e) {
@@ -324,7 +324,7 @@ public class ScannerReportViewerApp {
try (CloseableIterator<ScannerReport.LineCoverage> it = reader.readComponentCoverage(component.getRef())) {
while (it.hasNext()) {
ScannerReport.LineCoverage coverage = it.next();
- coverageEditor.getDocument().insertString(coverageEditor.getDocument().getEndPosition().getOffset(), coverage + "\n", null);
+ coverageEditor.getDocument().insertString(coverageEditor.getDocument().getLength(), coverage + "\n", null);
}
} catch (Exception e) {
throw new IllegalStateException("Can't read code coverage for " + getNodeName(component), e);
@@ -399,7 +399,8 @@ public class ScannerReportViewerApp {
try (CloseableIterator<ScannerReport.SyntaxHighlightingRule> it = reader.readComponentSyntaxHighlighting(component.getRef())) {
while (it.hasNext()) {
ScannerReport.SyntaxHighlightingRule rule = it.next();
- highlightingEditor.getDocument().insertString(highlightingEditor.getDocument().getEndPosition().getOffset(), rule + "\n", null);
+ int offset = highlightingEditor.getDocument().getLength();
+ highlightingEditor.getDocument().insertString(offset, rule + "\n", null);
}
} catch (Exception e) {
throw new IllegalStateException("Can't read syntax highlighting for " + getNodeName(component), e);
@@ -411,7 +412,7 @@ public class ScannerReportViewerApp {
try (CloseableIterator<ScannerReport.Measure> it = reader.readComponentMeasures(component.getRef())) {
while (it.hasNext()) {
ScannerReport.Measure measure = it.next();
- measuresEditor.getDocument().insertString(measuresEditor.getDocument().getEndPosition().getOffset(), measure + "\n", null);
+ measuresEditor.getDocument().insertString(measuresEditor.getDocument().getLength(), measure + "\n", null);
}
} catch (Exception e) {
throw new IllegalStateException("Can't read measures for " + getNodeName(component), e);
@@ -428,15 +429,15 @@ public class ScannerReportViewerApp {
try {
int index = 0;
for (Changeset changeset : changesets.getChangesetList()) {
- scmEditor.getDocument().insertString(scmEditor.getDocument().getEndPosition().getOffset(), index + "\n", null);
- scmEditor.getDocument().insertString(scmEditor.getDocument().getEndPosition().getOffset(), changeset + "\n", null);
+ scmEditor.getDocument().insertString(scmEditor.getDocument().getLength(), index + "\n", null);
+ scmEditor.getDocument().insertString(scmEditor.getDocument().getLength(), changeset + "\n", null);
index++;
}
- scmEditor.getDocument().insertString(scmEditor.getDocument().getEndPosition().getOffset(), "\n", null);
+ scmEditor.getDocument().insertString(scmEditor.getDocument().getLength(), "\n", null);
int line = 1;
for (Integer idx : changesetIndexByLine) {
- scmEditor.getDocument().insertString(scmEditor.getDocument().getEndPosition().getOffset(), line + ": " + idx + "\n", null);
+ scmEditor.getDocument().insertString(scmEditor.getDocument().getLength(), line + ": " + idx + "\n", null);
line++;
}
@@ -450,7 +451,7 @@ public class ScannerReportViewerApp {
try (CloseableIterator<ScannerReport.Symbol> it = reader.readComponentSymbols(component.getRef())) {
while (it.hasNext()) {
ScannerReport.Symbol symbol = it.next();
- symbolEditor.getDocument().insertString(symbolEditor.getDocument().getEndPosition().getOffset(), symbol + "\n", null);
+ symbolEditor.getDocument().insertString(symbolEditor.getDocument().getLength(), symbol + "\n", null);
}
} catch (Exception e) {
throw new IllegalStateException("Can't read symbol references for " + getNodeName(component), e);