]> source.dussan.org Git - sonarqube.git/commitdiff
Fix regression
authorEvgeny Mandrikov <mandrikov@gmail.com>
Mon, 6 Feb 2012 12:59:31 +0000 (16:59 +0400)
committerFabrice Bellingard <bellingard@gmail.com>
Mon, 6 Feb 2012 15:27:33 +0000 (16:27 +0100)
plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/SonarEngine.java

index 2fbdde1ed4df4c25998e5023275315b442aa466b..961b085bf4f080db0da2ea6670d7ad5eb8db415c 100644 (file)
@@ -43,6 +43,8 @@ import org.sonar.duplications.token.TokenChunker;
 import org.sonar.plugins.cpd.index.IndexFactory;
 import org.sonar.plugins.cpd.index.SonarDuplicationsIndex;
 
+import javax.annotation.Nullable;
+
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.InputStreamReader;
@@ -171,8 +173,8 @@ public class SonarEngine extends CpdEngine {
     return JavaFile.fromRelativePath(inputFile.getRelativePath(), false);
   }
 
-  static void save(SensorContext context, Resource resource, Iterable<CloneGroup> duplications) {
-    if (Iterables.isEmpty(duplications)) {
+  static void save(SensorContext context, Resource resource, @Nullable Iterable<CloneGroup> duplications) {
+    if (duplications == null || Iterables.isEmpty(duplications)) {
       return;
     }
     // Calculate number of lines and blocks