Skip to content

Commit

Permalink
Check for parse error before using the json document
Browse files Browse the repository at this point in the history
For stats query, the json document needs to be checked for parse error
before iterating the document.

Change-Id: I589b4f7da9eb11fd3489d3d1e5ca39a85d5b9cca
Partial-Bug: #1548891
  • Loading branch information
Sundaresan Rajangam committed Mar 4, 2016
1 parent 4ea0e95 commit 4107e51
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/query_engine/select.cc
Expand Up @@ -443,7 +443,12 @@ query_status_t SelectQuery::process_query() {

//uint64_t thenj = UTCTimestampUsec();
rapidjson::Document d;
d.Parse<0>(const_cast<char *>(json_string.c_str()));
if (d.Parse<0>(const_cast<char *>(
json_string.c_str())).HasParseError()) {
QE_LOG(ERROR, "Error parsing json document: " <<
d.GetParseError() << " - " << json_string);
continue;
}
//jsont += UTCTimestampUsec() - thenj;

std::vector<StatsSelect::StatEntry> attribs;
Expand Down

0 comments on commit 4107e51

Please sign in to comment.