aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2017-08-02 14:13:40 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2017-08-04 14:58:16 +0200
commit9ad1582eadfd88239c359bd4cad50d589f65c2a3 (patch)
tree60a27072f6acf3fe7053199769d07f6bb1f4f78d
parent343758acd64fd2318a35c5f55c6511cf8b2f6467 (diff)
downloadsonarqube-9ad1582eadfd88239c359bd4cad50d589f65c2a3.tar.gz
sonarqube-9ad1582eadfd88239c359bd4cad50d589f65c2a3.zip
Fix quality flaws
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultInputFile.java13
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/internal/DefaultCoverage.java2
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/AbstractPhaseExecutor.java2
3 files changed, 8 insertions, 9 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultInputFile.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultInputFile.java
index 3562a8d9010..917440ecb77 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultInputFile.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultInputFile.java
@@ -341,18 +341,17 @@ public class DefaultInputFile extends DefaultInputComponent implements InputFile
}
@Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
}
- // Use instanceof to support DeprecatedDefaultInputFile
- if (!(o instanceof DefaultInputFile)) {
+ if (this.getClass() != obj.getClass()) {
return false;
}
- DefaultInputFile that = (DefaultInputFile) o;
- return this.moduleKey().equals(that.moduleKey()) && this.relativePath().equals(that.relativePath());
+ DefaultInputFile that = (DefaultInputFile) obj;
+ return this.getProjectRelativePath().equals(that.getProjectRelativePath());
}
@Override
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/internal/DefaultCoverage.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/internal/DefaultCoverage.java
index 04625256a65..1f4b198305b 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/internal/DefaultCoverage.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/internal/DefaultCoverage.java
@@ -90,7 +90,7 @@ public class DefaultCoverage extends DefaultStorable implements NewCoverage {
}
private void validateLine(int line) {
- checkState(line <= inputFile.lines(), "Line %s is out of range in the file %s (lines: %s)", line, inputFile.relativePath(), inputFile.lines());
+ checkState(line <= inputFile.lines(), "Line %s is out of range in the file %s (lines: %s)", line, inputFile, inputFile.lines());
checkState(line > 0, "Line number must be strictly positive: %s", line);
}
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/AbstractPhaseExecutor.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/AbstractPhaseExecutor.java
index 02232592b42..9cb8512f6b7 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/AbstractPhaseExecutor.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/AbstractPhaseExecutor.java
@@ -126,7 +126,7 @@ public abstract class AbstractPhaseExecutor {
eventBus.fireEvent(new BatchStepEvent(stepName, true));
for (InputFile inputFile : fs.inputFiles(fs.predicates().all())) {
- issueExclusionsLoader.addMulticriteriaPatterns(inputFile.relativePath(), inputFile.key());
+ issueExclusionsLoader.addMulticriteriaPatterns(((DefaultInputFile) inputFile).getModuleRelativePath(), inputFile.key());
}
eventBus.fireEvent(new BatchStepEvent(stepName, false));