You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2019/03/05 18:16:07 UTC

[GitHub] [nifi-minifi-cpp] arpadboda commented on a change in pull request #499: MINIFICPP-748 - Nanofi: add custom C processor example

arpadboda commented on a change in pull request #499: MINIFICPP-748 - Nanofi: add custom C processor example
URL: https://github.com/apache/nifi-minifi-cpp/pull/499#discussion_r262620167
 
 

 ##########
 File path: nanofi/src/api/nanofi.cpp
 ##########
 @@ -371,9 +371,18 @@ int8_t remove_attribute(flow_file_record *ff, const char *key) {
 int get_content(const flow_file_record* ff, uint8_t* target, int size) {
   NULL_CHECK(0, ff, target);
   auto content_repo = static_cast<std::shared_ptr<minifi::core::ContentRepository>*>(ff->crp);
-  std::shared_ptr<minifi::ResourceClaim> claim = std::make_shared<minifi::ResourceClaim>(ff->contentLocation, *content_repo);
-  auto stream = (*content_repo)->read(claim);
-  return stream->read(target, size);
+  if(ff->crp && (*content_repo)) {
+    std::shared_ptr<minifi::ResourceClaim> claim = std::make_shared<minifi::ResourceClaim>(ff->contentLocation,
+                                                                                           *content_repo);
+    auto stream = (*content_repo)->read(claim);
+    return stream->read(target, size);
+  } else {
 
 Review comment:
   The problem here is that ff->contentlocation is used for two different purpose:
   -A simple filename to show where the content of the flowfile in the filesystem is
   -An internal string that represent the location of the file within the content repo
   
   I think this should be separated.
   @phrocker do you have any longer term plan to resolve this in nanofi? 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services