From 370957d93baad2d590e9d1cd08fca88edc587e1e Mon Sep 17 00:00:00 2001 From: Evgeny Mandrikov Date: Mon, 6 Feb 2012 16:59:31 +0400 Subject: [PATCH] Fix regression --- .../src/main/java/org/sonar/plugins/cpd/SonarEngine.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 -- 2.39.5