turcsanyip commented on a change in pull request #4747:
URL: https://github.com/apache/nifi/pull/4747#discussion_r554009142



##########
File path: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/HandleHttpResponse.java
##########
@@ -204,7 +206,7 @@ public void onTrigger(final ProcessContext context, final 
ProcessSession session
 
         try {
             contextMap.complete(contextIdentifier);
-        } catch (final IllegalStateException ise) {
+        } catch (final RuntimeException ise) {

Review comment:
       `ise` seems to be a leftover from the previous version.
   Could you please use `ce` here too like in line 197. 

##########
File path: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/HandleHttpResponse.java
##########
@@ -194,7 +192,11 @@ public void onTrigger(final ProcessContext context, final 
ProcessSession session
         } catch (final ProcessException e) {
             session.transfer(flowFile, REL_FAILURE);
             getLogger().error("Failed to respond to HTTP request for {} due to 
{}", new Object[]{flowFile, e});
-            contextMap.complete(contextIdentifier);
+            try {

Review comment:
       Not a new issue but it could be improved around exception handling:
   The typical (by convention) error handling flow is logging first, then 
sending the FF to FAILURE (in case of an exception in `session.transfer()`). 
Like in the last catch block at lines 210-211.
   
   This catch and the others throughout onTrigger()  do it vice versa.
   I would consider moving the
   `session.transfer(flowFile, REL_FAILURE);`
   lines just before the return statements.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to