@Override
  public Optional<ReadError> read(DbFileSources.Line.Builder lineBuilder) {
    if (readError == null) {
      try {
        processHighlightings(lineBuilder);
      } catch (RangeOffsetConverterException e) {
        readError = new ReadError(HIGHLIGHTING, lineBuilder.getLine());
        LOG.debug(format("Inconsistency detected in Highlighting data. Highlighting will be ignored for file '%s'", file.getKey()), e);
      }
    }
    return Optional.ofNullable(readError);
  }
@Test
  public void keep_existing_processed_highlighting_when_range_offset_converter_throw_RangeOffsetConverterException() {
    TextRange textRange2 = newTextRange(LINE_2, LINE_2);
    doThrow(RangeOffsetConverterException.class).when(rangeOffsetConverter).offsetToString(textRange2, LINE_2, DEFAULT_LINE_LENGTH);
    TextRange textRange3 = newTextRange(LINE_3, LINE_3);

    HighlightingLineReader highlightingLineReader = newReader(of(
      newSingleLineTextRangeWithExpectingLabel(LINE_1, RANGE_LABEL_1), ANNOTATION,
      textRange2, HIGHLIGHTING_STRING,
      textRange3, COMMENT));

    assertThat(highlightingLineReader.read(line1)).isEmpty();
    LineReader.ReadError readErrorLine2 = new LineReader.ReadError(HIGHLIGHTING, LINE_2);
    assertThat(highlightingLineReader.read(line2)).contains(readErrorLine2);
    assertThat(highlightingLineReader.read(line3)).contains(readErrorLine2);

    assertThat(line1.hasHighlighting()).isTrue();
    assertThat(line2.hasHighlighting()).isFalse();
    assertThat(line3.hasHighlighting()).isFalse();
    assertThat(logTester.logs(DEBUG)).isNotEmpty();
  }