Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
3.7.0
Description
In certain scenarios when investigating empty nodes, ZooInspector encounters NullPointerExceptions such as (from testing an Apache Helix cluster):
ERROR [SwingWorker-pool-1-thread-3] (ZooInspectorManagerImpl.java:255) - Error occurred getting data for node: /BrentTest/EXTERNALVIEWERROR [SwingWorker-pool-1-thread-3] (ZooInspectorManagerImpl.java:255) - Error occurred getting data for node: /BrentTest/EXTERNALVIEWjava.lang.NullPointerException at java.lang.String.<init>(String.java:566) at org.apache.zookeeper.inspector.encryption.BasicDataEncryptionManager.decryptData(BasicDataEncryptionManager.java:33) at org.apache.zookeeper.inspector.manager.ZooInspectorManagerImpl.getData(ZooInspectorManagerImpl.java:251) at org.apache.zookeeper.inspector.gui.nodeviewer.NodeViewerData$2.doInBackground(NodeViewerData.java:105) at org.apache.zookeeper.inspector.gui.nodeviewer.NodeViewerData$2.doInBackground(NodeViewerData.java:100) at javax.swing.SwingWorker$1.call(SwingWorker.java:295) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at javax.swing.SwingWorker.run(SwingWorker.java:334) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)
By default, ZooInspector uses org.apache.zookeeper.inspector.encryption.BasicDataEncryptionManager to decrypt node data using this code:
public String decryptData(byte[] encrypted) throws Exception { return new String(encrypted); }
But "encrypted" can get passed as "null" which causes the issue. It seems like this is probably a pretty easy fix (this code seems to do it):
public String decryptData(byte[] encrypted) throws Exception { return encrypted != null ? new String(encrypted) : ""; }
I can put this on my list of PRs to submit if that seems reasonable.
Attachments
Issue Links
- links to