Skip to content

Commit

Permalink
Update deprecated Json::Reader to Json::CharReader
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangskz committed Sep 18, 2024
1 parent cc228f1 commit 189b206
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions conformance/binary_json_conformance_suite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -643,13 +643,16 @@ void BinaryAndJsonConformanceSuiteImpl<
response.result_case()));
return;
}
Json::Reader reader;
Json::CharReaderBuilder builder;
Json::Value value;
if (!reader.parse(response.json_payload(), value)) {
Json::String err;
const std::unique_ptr<Json::CharReader> reader(builder.newCharReader());
if (!reader->parse(response.json_payload().c_str(), response.json_payload().c_str() + response.json_payload().length(), &value,
&err)) {
suite_.ReportFailure(
effective_test_name, level, request, response,
absl::StrCat("JSON payload cannot be parsed as valid JSON: ",
reader.getFormattedErrorMessages()));
err));
return;
}
if (!validator(value)) {
Expand Down

0 comments on commit 189b206

Please sign in to comment.