From: Evgeny Mandrikov Date: Mon, 6 Feb 2012 12:59:31 +0000 (+0400) Subject: Fix regression X-Git-Tag: 2.14~170^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=370957d93baad2d590e9d1cd08fca88edc587e1e;p=sonarqube.git Fix regression --- diff --git a/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/SonarEngine.java b/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/SonarEngine.java index 2fbdde1ed4d..961b085bf4f 100644 --- a/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/SonarEngine.java +++ b/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/SonarEngine.java @@ -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 duplications) { - if (Iterables.isEmpty(duplications)) { + static void save(SensorContext context, Resource resource, @Nullable Iterable duplications) { + if (duplications == null || Iterables.isEmpty(duplications)) { return; } // Calculate number of lines and blocks