Merge pull request #3 from alfredodiaz/master

prevent NullPointerException if znode contains no data. TODO comment …
This commit is contained in:
Spencer Gibb
2015-05-19 11:02:41 -04:00

View File

@@ -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 {