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_r296875401
 
 

 ##########
 File path: libminifi/src/core/ProcessSession.cpp
 ##########
 @@ -606,33 +622,28 @@ void ProcessSession::import(std::string source, 
std::vector<std::shared_ptr<Flow
           uint64_t endTime = getTimeMillis();
           provenance_report_->modifyContent(flowFile, details, endTime - 
startTime);
           flows.push_back(flowFile);
-        } else {
-          logger_->log_debug("Error while writing");
-          stream->closeStream();
-          throw Exception(FILE_OPERATION_EXCEPTION, "File Export Error 
creating Flowfile");
+
+          /* Reset these to start processing the next FlowFile with a clean 
slate */
+          flowFile.reset();
+          stream.reset();
+          claim.reset();
+
+          /* Skip delimiter */
+          begin = delimiterPos + 1;
         }
       }
-      input.close();
-      logger_->log_trace("Closed input %s, keeping source ? %i", source, 
keepSource);
-      if (!keepSource)
-        std::remove(source.c_str());
-    } else {
-      input.close();
-      throw Exception(FILE_OPERATION_EXCEPTION, "File Import Error");
+    } catch (std::exception &exception) {
+      logger_->log_debug("Caught Exception %s", exception.what());
+      throw;
+    } catch (...) {
+      logger_->log_debug("Caught Exception during process session write");
+      throw;
     }
-  } catch (std::exception &exception) {
-    if (flowFile && flowFile->getResourceClaim() == claim) {
 
 Review comment:
   I did not remove it, I have deduplicated it. See the comment above.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to