This is an automated email from the ASF dual-hosted git repository.

ijokarumawak pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/master by this push:
     new 097b9c3  NIFI-6022 Added try/catch to protect against secondary 
exception in a primary exception catch clause
097b9c3 is described below

commit 097b9c30754c77858aff684b113ed305cec7cf57
Author: slyouts <syoutse...@gmail.com>
AuthorDate: Wed May 15 15:19:25 2019 -0400

    NIFI-6022 Added try/catch to protect against secondary exception in a 
primary exception catch clause
    
    NIFI-6022 mods per PR review
    
    NIFI-6022 mods per PR review
    
    This closes #3476.
    
    Signed-off-by: Koji Kawamura <ijokaruma...@apache.org>
---
 .../src/main/java/org/apache/nifi/jms/processors/JMSConsumer.java  | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/processors/JMSConsumer.java
 
b/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/processors/JMSConsumer.java
index a2c73b4..3c16ee2 100644
--- 
a/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/processors/JMSConsumer.java
+++ 
b/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/processors/JMSConsumer.java
@@ -126,7 +126,12 @@ final class JMSConsumer extends JMSWorker {
                     // We need to call recover to ensure that in the event of
                     // abrupt end or exception the current session will stop 
message
                     // delivery and restart with the oldest unacknowledged 
message
-                    session.recover();
+                    try {
+                        session.recover();
+                    } catch (Exception e1) {
+                        // likely the session is closed...need to catch this 
so that the root cause of failure is propagated
+                        processLog.debug("Failed to recover JMS session while 
handling initial error. The recover error is: ", e1);
+                    }
                     throw e;
                 } finally {
                     JmsUtils.closeMessageConsumer(msgConsumer);

Reply via email to