aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2014-10-16 09:09:34 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2014-10-16 09:09:34 +0200
commitffa03bd7809651a132e77fd74f79fc3eb1636e5c (patch)
tree30cc3c0bde3a11f94f904f261c091929274325a2 /plugins
parentb82da6d622c3648f016098eb6964555ad75879f9 (diff)
downloadsonarqube-ffa03bd7809651a132e77fd74f79fc3eb1636e5c.tar.gz
sonarqube-ffa03bd7809651a132e77fd74f79fc3eb1636e5c.zip
Fix some quality flaws
Diffstat (limited to 'plugins')
-rw-r--r--plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/CoveragePerTestSensor.java3
-rw-r--r--plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/DependencySensor.java3
2 files changed, 6 insertions, 0 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)