<commit_before>#include "SubDocPropValueRenderer.h"
#include <rapidjson/document.h>
#include <glog/logging.h>

namespace sf1r
{
void SubDocPropValueRenderer::renderSubDocPropValue(
    const std::string& propName,
    const std::string& origText,
    izenelib::driver::Value& resourceValue)
{
    if (origText.empty())
        return;
    rapidjson::Document doc;
    doc.Parse<0>(origText.c_str());
    const rapidjson::Value& subDocs = doc;
    assert(subDocs.IsArray());
    for (rapidjson::Value::ConstValueIterator vit = subDocs.Begin();
            vit != subDocs.End(); vit++)
    {
        izenelib::driver::Value& subDoc = resourceValue();
        for (rapidjson::Value::ConstMemberIterator mit = vit->MemberBegin();
             mit != vit->MemberEnd(); mit++)
        {
            subDoc[mit->name.GetString()]=mit->value.GetString();
        }
    }
}
}<commit_msg>Add checker for illegal json string<commit_after>#include "SubDocPropValueRenderer.h"
#include <rapidjson/document.h>
#include <glog/logging.h>

namespace sf1r
{
void SubDocPropValueRenderer::renderSubDocPropValue(
    const std::string& propName,
    const std::string& origText,
    izenelib::driver::Value& resourceValue)
{
    if (origText.empty())
        return;
    rapidjson::Document doc;
    if (doc.Parse<0>(origText.c_str()).HasParseError());
    {
        return;
    }
    const rapidjson::Value& subDocs = doc;
    assert(subDocs.IsArray());
    for (rapidjson::Value::ConstValueIterator vit = subDocs.Begin();
            vit != subDocs.End(); vit++)
    {
        izenelib::driver::Value& subDoc = resourceValue();
        for (rapidjson::Value::ConstMemberIterator mit = vit->MemberBegin();
             mit != vit->MemberEnd(); mit++)
        {
            subDoc[mit->name.GetString()]=mit->value.GetString();
        }
    }
}
}
{'fraction_non_alphanumeric': 0.1510673234811166, 'fraction_numerical': 0.0021893814997263274, 'mean_word_length': 3.3011764705882354, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6535914', 'n_tokens_mistral': 575, 'n_tokens_neox': 575, 'n_words': 101}