Github user calebj commented on a diff in the pull request:
https://github.com/apache/nifi-minifi-cpp/pull/191#discussion_r152182652
--- Diff: extensions/libarchive/UnfocusArchiveEntry.cpp ---
@@ -67,55 +66,41 @@ void
UnfocusArchiveEntry::onTrigger(core::ProcessContext *context, core::Process
}
fileutils::FileManager file_man;
-
- // Get lens stack from attribute
ArchiveMetadata lensArchiveMetadata;
- Json::Value lensStack;
- Json::Reader reader;
-
- std::string existingLensStack;
-
- if (flowFile->getAttribute("lens.archive.stack", existingLensStack)) {
- logger_->log_info("UnfocusArchiveEntry loading existing lens context");
-
- // TODO(calebj) handle any exceptions that might arise from working
with JSON data
- if (!reader.parse(existingLensStack, lensStack)) {
- logger_->log_error("UnfocusArchiveEntry JSON parse error: %s",
reader.getFormattedErrorMessages());
- context->yield();
- return;
+ // Get lens stack from attribute
+ {
+ ArchiveStack archiveStack;
+ {
+ std::string existingLensStack;
+
+ if (flowFile->getAttribute("lens.archive.stack", existingLensStack))
{
+ logger_->log_info("FocusArchiveEntry loading existing lens
context");
+
+ try {
+ archiveStack.loadJsonString(existingLensStack);
--- End diff --
Done in 00282396e2b2fa3f0f450a7916d692b52c749a1d
---