thenatog commented on a change in pull request #4592:
URL: https://github.com/apache/nifi/pull/4592#discussion_r508875708



##########
File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/providers/zookeeper/ZooKeeperStateProvider.java
##########
@@ -167,11 +289,26 @@ synchronized ZooKeeper getZooKeeper() throws IOException {
         }
 
         if (zooKeeper == null) {
-            zooKeeper = new ZooKeeper(connectionString, timeoutMillis, new 
Watcher() {
-                @Override
-                public void process(WatchedEvent event) {
+            if(zooKeeperClientConfig != null && 
zooKeeperClientConfig.getClientSecure()) {
+                SecureClientZooKeeperFactory factory = new 
SecureClientZooKeeperFactory(zooKeeperClientConfig);
+                try {
+                    zooKeeper = factory.newZooKeeper(connectionString, 
timeoutMillis, new Watcher() {
+                        @Override
+                        public void process(WatchedEvent event) {
+                        }
+                    }, true);
+                } catch (Exception e) {
+                    System.out.println("Secure Zookeeper configuration 
failed!");
+                    e.printStackTrace();
+                    invalidateClient();
                 }
-            });
+            } else {
+                zooKeeper = new ZooKeeper(connectionString, timeoutMillis, new 
Watcher() {
+                    @Override
+                    public void process(WatchedEvent event) {
+                    }
+                });

Review comment:
       I'm seeing this error if I do that:
   ```
   2388 [Time-limited test-EventThread] ERROR o.a.z.ClientCnxn - Error while 
calling watcher 
   java.lang.NullPointerException: null
        at 
org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:535)
        at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:510)
   ```




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


Reply via email to