@Override
  public SarifSchema210 deserialize(Path reportPath) {
    try {
      return mapper
        .enable(JsonParser.Feature.INCLUDE_SOURCE_IN_LOCATION)
        .addHandler(new DeserializationProblemHandler() {
          @Override
          public Object handleInstantiationProblem(DeserializationContext ctxt, Class<?> instClass, Object argument, Throwable t) throws IOException {
            if (!instClass.equals(SarifSchema210.Version.class)) {
              return NOT_HANDLED;
            }
            throw new UnsupportedSarifVersionException(format(UNSUPPORTED_VERSION_MESSAGE_TEMPLATE, argument), t);
          }
        })
        .readValue(reportPath.toFile(), SarifSchema210.class);
    } catch (UnsupportedSarifVersionException e) {
      throw new IllegalStateException(e.getMessage(), e);
    } catch (JsonMappingException | JsonParseException e) {
      throw new IllegalStateException(format(SARIF_JSON_SYNTAX_ERROR, reportPath), e);
    } catch (IOException e) {
      throw new IllegalStateException(format(SARIF_REPORT_ERROR, reportPath), e);
    }
  }
@Test
  public void deserialize_whenFileIsNotUtf8encoded_shouldFail() throws URISyntaxException {
    URL sarifResource = requireNonNull(getClass().getResource("sarif210-nonUtf8.json"));
    Path sarif = Paths.get(sarifResource.toURI());

    assertThatThrownBy(() -> serializer.deserialize(sarif))
      .isInstanceOf(IllegalStateException.class)
      .hasMessage(format("Failed to read SARIF report at '%s': invalid JSON syntax or file is not UTF-8 encoded", sarif));
  }