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/06/24 19:16:35 UTC

[GitHub] [nifi-minifi-cpp] bakaid commented on a change in pull request #596: MINIFICPP-925 - Fix TailFile hang on long lines

bakaid commented on a change in pull request #596: MINIFICPP-925 - Fix TailFile hang on long lines
URL: https://github.com/apache/nifi-minifi-cpp/pull/596#discussion_r296874849
 
 

 ##########
 File path: libminifi/src/core/ProcessSession.cpp
 ##########
 @@ -537,63 +534,82 @@ void ProcessSession::import(std::string source, const std::shared_ptr<core::Flow
   }
 }
 
-void ProcessSession::import(std::string source, std::vector<std::shared_ptr<FlowFileRecord>> &flows, bool keepSource, uint64_t offset, char inputDelimiter) {
+void ProcessSession::import(const std::string& source, std::vector<std::shared_ptr<FlowFileRecord>> &flows, uint64_t offset, char inputDelimiter) {
   std::shared_ptr<ResourceClaim> claim;
+  std::shared_ptr<io::BaseStream> stream;
   std::shared_ptr<FlowFileRecord> flowFile;
-  int size = getpagesize();
-  std::vector<char> charBuffer;
-  charBuffer.resize(size);
 
+  std::vector<uint8_t> buffer(getpagesize());
   try {
-    // Open the input file and seek to the appropriate location.
-    std::ifstream input;
-    logger_->log_debug("Opening %s", source);
-    input.open(source.c_str(), std::fstream::in | std::fstream::binary);
-    if (input.is_open() && input.good()) {
-      if (offset != 0) {
+    try {
+      std::ifstream input;
 
 Review comment:
   GitHub's diff is really hard to read properly, but this is not a spacing change, it is a new try-catch block.
   Along with the change in the catch blocks, this is to eliminate a code duplication. (We log the errors separately for std::exception and other exceptions, then rethrow the exception and decrement the claim refcounter).

----------------------------------------------------------------
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