Lehel44 commented on a change in pull request #4952:
URL: https://github.com/apache/nifi/pull/4952#discussion_r726514279



##########
File path: 
nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/SiteToSiteBulletinReportingTask.java
##########
@@ -162,23 +161,21 @@ public void onTrigger(final ReportingContext context) {
 
             final long transferMillis = 
TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
             getLogger().info("Successfully sent {} Bulletins to destination in 
{} ms; Transaction ID = {}; First Event ID = {}",
-                    new Object[]{bulletins.size(), transferMillis, 
transactionId, bulletins.get(0).getId()});
-        } catch (final Exception e) {
+                    bulletins.size(), transferMillis, transactionId, 
bulletins.get(0).getId());
+        } catch (ProcessException e) {
+            throw e;
+        } catch (Exception e) {
             if (transaction != null) {
                 transaction.error();
             }
-            if (e instanceof ProcessException) {
-                throw (ProcessException) e;
-            } else {
-                throw new ProcessException("Failed to send Bulletins to 
destination due to IOException:" + e.getMessage(), e);
-            }
+            throw new ProcessException("Failed to send Bulletins to 
destination due to IOException:" + e.getMessage(), e);

Review comment:
       I removed the positive branch of the if statement on line 170 because it 
appears to always be false. On line 165 all the ProcessExceptions will be 
caught already and will be thrown to the next caller method. Therefore the 
check on 170 for ProcessException to me seems unnecessary. Did I miss anything?




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to