prevent NullPointerException if znode contains no data. TODO comment about possible race conditions due to method TreeCache.process(..) is asynchronous
This commit is contained in:
@@ -42,6 +42,11 @@ public class ZookeeperPropertySource extends EnumerablePropertySource<CuratorFra
|
||||
cache = TreeCache.newBuilder(source, context).build();
|
||||
cache.start();
|
||||
running = true;
|
||||
/*
|
||||
TODO: race condition since TreeCache.process(..) is invoked asynchronously.
|
||||
Methods getProperty and getPropertyNames could be invoked before that TreeCache.process(..) receives
|
||||
all the WatchedEvents.
|
||||
*/
|
||||
}
|
||||
catch (NoNodeException e) {
|
||||
// no node, ignore
|
||||
@@ -74,7 +79,7 @@ public class ZookeeperPropertySource extends EnumerablePropertySource<CuratorFra
|
||||
return;
|
||||
for (Map.Entry<String, ChildData> entry : children.entrySet()) {
|
||||
ChildData child = entry.getValue();
|
||||
if (child.getData().length == 0) {
|
||||
if (child.getData()==null || child.getData().length == 0) {
|
||||
findKeys(keys, child.getPath());
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user