]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-13158 Scanner logs files indexed with language 'null'
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Wed, 4 Mar 2020 13:59:35 +0000 (07:59 -0600)
committersonartech <sonartech@sonarsource.com>
Fri, 13 Mar 2020 20:04:14 +0000 (20:04 +0000)
sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/FileIndexer.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java

index 74dbe5bec00d6c5c817f3a29e66933157342e348..21435f623ad3b3e9e398a9101cad172ef857f93a 100644 (file)
@@ -44,6 +44,8 @@ import org.sonar.scanner.issue.ignore.scanner.IssueExclusionsLoader;
 import org.sonar.scanner.scan.ScanProperties;
 import org.sonar.scanner.util.ProgressReport;
 
+import static java.lang.String.format;
+
 /**
  * Index input files into {@link InputComponentStore}.
  */
@@ -141,7 +143,8 @@ public class FileIndexer {
     checkIfAlreadyIndexed(inputFile);
     componentStore.put(module.key(), inputFile);
     issueExclusionsLoader.addMulticriteriaPatterns(inputFile);
-    LOG.debug("'{}' indexed {}with language '{}'", projectRelativePath, type == Type.TEST ? "as test " : "", inputFile.language());
+    String langStr = inputFile.language() != null ? format("with language '%s'", inputFile.language()) : "with no language";
+    LOG.debug("'{}' indexed {}{}", projectRelativePath, type == Type.TEST ? "as test " : "", langStr);
     evaluateCoverageExclusions(moduleCoverageAndDuplicationExclusions, inputFile);
     evaluateDuplicationExclusions(moduleCoverageAndDuplicationExclusions, inputFile);
     if (properties.preloadFileMetadata()) {
index 7d2bb6cc9fbc79d764bcab32c1f5f4c1d86e203a..0cc41665dea6b1a75bd2b8c178ddf70e300c954a 100644 (file)
@@ -222,6 +222,7 @@ public class FileSystemMediumTest {
         .build())
       .execute();
 
+    assertThat(logTester.logs()).contains("'src/main/sample.java' indexed with no language");
     assertThat(logTester.logs()).contains("3 files indexed");
     assertThat(logTester.logs()).contains("'src/main/sample.xoo' generated metadata with charset 'UTF-8'");
     assertThat(String.join("\n", logTester.logs())).doesNotContain("'src/main/sample.java' generated metadata");