Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dont abort JSON import when encountering non-objects #1759

Merged
merged 3 commits into from Jul 6, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog/unreleased/bug-fixes/1759--json-import-abort.md
@@ -0,0 +1,3 @@
VAST does not abort an import of JSON data anymore when encountering
something other than a JSON object (ie. a number or a string)
lava marked this conversation as resolved.
Show resolved Hide resolved
Instead, the offending line is skipped.
9 changes: 7 additions & 2 deletions libvast/vast/format/json.hpp
Expand Up @@ -192,8 +192,13 @@ caf::error reader<Selector>::read_impl(size_t max_events, size_t max_slice_size,
continue;
}
auto get_object_result = parse_result.get_object();
if (get_object_result.error() != ::simdjson::error_code::SUCCESS)
return caf::make_error(ec::type_clash, "not a json object");
if (get_object_result.error() != ::simdjson::error_code::SUCCESS) {
if (num_invalid_lines_ == 0)
VAST_WARN("{} failed to parse line as JSON object {}: {}",
detail::pretty_type_name(this), lines_->line_number(), line);
++num_invalid_lines_;
continue;
}
auto&& layout = selector_(get_object_result.value());
if (!layout) {
if (num_unknown_layouts_ == 0)
Expand Down