]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-11238 debug log instead of warn when highlighting data error
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Wed, 12 Sep 2018 09:11:48 +0000 (11:11 +0200)
committersonartech <sonartech@sonarsource.com>
Wed, 10 Oct 2018 07:23:02 +0000 (09:23 +0200)
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/linereader/HighlightingLineReader.java
server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/linereader/HighlightingLineReaderTest.java

index 73668d40c5fb0c4c5c00644aab3be5659fef387c..6e7b818e098d20a4b3e3c70a6913ece420d2f9f1 100644 (file)
@@ -83,7 +83,7 @@ public class HighlightingLineReader implements LineReader {
         processHighlightings(lineBuilder);
       } catch (RangeOffsetConverterException e) {
         readError = new ReadError(HIGHLIGHTING, lineBuilder.getLine());
-        LOG.warn(format("Inconsistency detected in Highlighting data. Highlighting will be ignored for file '%s'", file.getDbKey()), e);
+        LOG.debug(format("Inconsistency detected in Highlighting data. Highlighting will be ignored for file '%s'", file.getDbKey()), e);
       }
     }
     return Optional.ofNullable(readError);
index f6882b07f572e06355a032debc3587624c06c58b..703182115e760c8111aa8175132a249decd3661b 100644 (file)
@@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.Mockito.doThrow;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
-import static org.sonar.api.utils.log.LoggerLevel.WARN;
+import static org.sonar.api.utils.log.LoggerLevel.DEBUG;
 import static org.sonar.ce.task.projectanalysis.component.ReportComponent.builder;
 import static org.sonar.ce.task.projectanalysis.source.linereader.LineReader.Data.HIGHLIGHTING;
 import static org.sonar.db.protobuf.DbFileSources.Data.newBuilder;
@@ -259,7 +259,7 @@ public class HighlightingLineReaderTest {
     assertThat(highlightingLineReader.read(line2)).contains(readErrorLine1);
 
     assertNoHighlighting();
-    assertThat(logTester.logs(WARN)).isNotEmpty();
+    assertThat(logTester.logs(DEBUG)).isNotEmpty();
   }
 
   @Test
@@ -281,11 +281,11 @@ public class HighlightingLineReaderTest {
     assertThat(line1.hasHighlighting()).isTrue();
     assertThat(line2.hasHighlighting()).isFalse();
     assertThat(line3.hasHighlighting()).isFalse();
-    assertThat(logTester.logs(WARN)).isNotEmpty();
+    assertThat(logTester.logs(DEBUG)).isNotEmpty();
   }
 
   @Test
-  public void display_file_key_in_warning_when_range_offset_converter_throw_RangeOffsetConverterException() {
+  public void display_file_key_in_debug_when_range_offset_converter_throw_RangeOffsetConverterException() {
     TextRange textRange1 = newTextRange(LINE_1, LINE_1);
     doThrow(RangeOffsetConverterException.class).when(rangeOffsetConverter).offsetToString(textRange1, LINE_1, DEFAULT_LINE_LENGTH);
     HighlightingLineReader highlightingLineReader = newReader(of(textRange1, ANNOTATION));
@@ -293,7 +293,7 @@ public class HighlightingLineReaderTest {
     assertThat(highlightingLineReader.read(line1))
       .contains(new LineReader.ReadError(HIGHLIGHTING, 1));
 
-    assertThat(logTester.logs(WARN)).containsOnly("Inconsistency detected in Highlighting data. Highlighting will be ignored for file 'FILE_KEY'");
+    assertThat(logTester.logs(DEBUG)).containsOnly("Inconsistency detected in Highlighting data. Highlighting will be ignored for file 'FILE_KEY'");
   }
 
   private HighlightingLineReader newReader(Map<TextRange, HighlightingType> textRangeByType) {