| 131 | } |
| 132 | |
| 133 | bool JsonReader::fetch_bool(const std::vector<std::string> &keys, const bool &default_value) |
| 134 | { |
| 135 | json::json_pointer ptr = json::json_pointer(to_json_pointer(keys)); |
| 136 | try |
| 137 | { |
| 138 | if (j.at(ptr).is_boolean()) |
| 139 | { |
| 140 | return j.at(ptr); |
| 141 | } |
| 142 | else |
| 143 | { |
| 144 | throw nlohmann::detail::other_error::create(900, "type should be boolean"); |
| 145 | } |
| 146 | } |
| 147 | catch (const nlohmann::detail::exception &e) |
| 148 | { |
| 149 | if (get_exception_report()) |
| 150 | { |
| 151 | openrasp_error(LEVEL_WARNING, CONFIG_ERROR, _("%s, config \"%s\" use the default value \"%s\""), |
| 152 | e.what(), BaseReader::stringfy_keys(keys).c_str(), default_value ? "true" : "false"); |
| 153 | } |
| 154 | } |
| 155 | return default_value; |
| 156 | } |
| 157 | |
| 158 | std::vector<std::string> JsonReader::fetch_object_keys(const std::vector<std::string> &keys) |
| 159 | { |
no test coverage detected