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

joewitt 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 4fec54d  NIFI-6996 This closes #3981. Fixed a stackoverflow that 
occurs when a subscription fails.
4fec54d is described below

commit 4fec54debfdf8face33cb1738a0d2b340e249f09
Author: Gal Shinder <[email protected]>
AuthorDate: Sat Jan 11 23:39:49 2020 +0200

    NIFI-6996 This closes #3981. Fixed a stackoverflow that occurs when a 
subscription fails.
    
    Signed-off-by: Joe Witt <[email protected]>
---
 .../nifi/processors/windows/event/log/ConsumeWindowsEventLog.java | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/nifi-nar-bundles/nifi-windows-event-log-bundle/nifi-windows-event-log-processors/src/main/java/org/apache/nifi/processors/windows/event/log/ConsumeWindowsEventLog.java
 
b/nifi-nar-bundles/nifi-windows-event-log-bundle/nifi-windows-event-log-processors/src/main/java/org/apache/nifi/processors/windows/event/log/ConsumeWindowsEventLog.java
index 22b2b34..7d2d1d9 100644
--- 
a/nifi-nar-bundles/nifi-windows-event-log-bundle/nifi-windows-event-log-processors/src/main/java/org/apache/nifi/processors/windows/event/log/ConsumeWindowsEventLog.java
+++ 
b/nifi-nar-bundles/nifi-windows-event-log-bundle/nifi-windows-event-log-processors/src/main/java/org/apache/nifi/processors/windows/event/log/ConsumeWindowsEventLog.java
@@ -239,8 +239,12 @@ public class ConsumeWindowsEventLog extends 
AbstractSessionFactoryProcessor {
         return null;
     }
 
+    private boolean isSubscriptionHandleOpen(){
+        return subscriptionHandle != null && subscriptionHandle.getPointer() 
!= null;
+    }
+
     private boolean isSubscribed() {
-        final boolean subscribed = subscriptionHandle != null && 
subscriptionHandle.getPointer() != null;
+        final boolean subscribed = isSubscriptionHandleOpen();
         final boolean subscriptionFailed = evtSubscribeCallback != null
             && ((EventSubscribeXmlRenderingCallback) 
evtSubscribeCallback).isSubscriptionFailed();
         final boolean subscribing = subscribed && !subscriptionFailed;
@@ -287,7 +291,7 @@ public class ConsumeWindowsEventLog extends 
AbstractSessionFactoryProcessor {
     }
 
     private void unsubscribe() {
-        if (isSubscribed()) {
+        if (isSubscriptionHandleOpen()) {
             wEvtApi.EvtClose(subscriptionHandle);
         }
         subscriptionHandle = null;

Reply via email to