diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2014-10-16 09:09:34 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2014-10-16 09:09:34 +0200 |
commit | ffa03bd7809651a132e77fd74f79fc3eb1636e5c (patch) | |
tree | 30cc3c0bde3a11f94f904f261c091929274325a2 | |
parent | b82da6d622c3648f016098eb6964555ad75879f9 (diff) | |
download | sonarqube-ffa03bd7809651a132e77fd74f79fc3eb1636e5c.tar.gz sonarqube-ffa03bd7809651a132e77fd74f79fc3eb1636e5c.zip |
Fix some quality flaws
3 files changed, 8 insertions, 1 deletions
diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/CoveragePerTestSensor.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/CoveragePerTestSensor.java index 70fe9b78ff7..e16829385c8 100644 --- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/CoveragePerTestSensor.java +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/CoveragePerTestSensor.java @@ -75,6 +75,9 @@ public class CoveragePerTestSensor implements Sensor { String mainFileRelativePath = split.next(); FileSystem fs = context.fileSystem(); InputFile mainFile = fs.inputFile(fs.predicates().hasRelativePath(mainFileRelativePath)); + if (mainFile == null) { + throw new IllegalStateException("Unable to find file " + mainFileRelativePath); + } List<Integer> coveredLines = new ArrayList<Integer>(); Iterator<String> lines = Splitter.on(",").split(split.next()).iterator(); while (lines.hasNext()) { diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/DependencySensor.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/DependencySensor.java index 929092da866..7ffca61bb62 100644 --- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/DependencySensor.java +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/DependencySensor.java @@ -73,6 +73,9 @@ public class DependencySensor implements Sensor { String otherFileRelativePath = split.next(); FileSystem fs = context.fileSystem(); InputFile otherFile = fs.inputFile(fs.predicates().hasRelativePath(otherFileRelativePath)); + if (otherFile == null) { + throw new IllegalStateException("Unable to find file " + otherFileRelativePath); + } int weight = Integer.parseInt(split.next()); context.newDependency() .from(file) diff --git a/sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java b/sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java index ab8ff21c33c..2886cfbc28c 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java +++ b/sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java @@ -269,7 +269,8 @@ public class BatchMediumTester { if (!coveragePerTest.get(testFileKey).containsKey(testName)) { coveragePerTest.get(testFileKey).put(testName, new HashMap<String, List<Integer>>()); } - coveragePerTest.get(testFileKey).get(testName).put(entry.key()[2].toString(), entry.value().coveredLines()); + TestCaseCoverage value = entry.value(); + coveragePerTest.get(testFileKey).get(testName).put(entry.key()[2].toString(), value != null ? value.coveredLines() : null); } } |