Avoid NPEs when starting up and scanning brokers
The problem was we were trying to parse the JSON of /brokers/ids' when the treecache found that node. Fixes #8
This commit is contained in:
parent
a022252157
commit
4f16c3dfd1
|
@ -68,9 +68,15 @@ class BrokerTreeWatcher implements TreeCacheListener {
|
|||
}
|
||||
|
||||
ChildData nodeData = event.data
|
||||
Integer brokerId = brokerIdFromPath(nodeData.path)
|
||||
|
||||
if (brokerId == INVALID_BROKER_ID) {
|
||||
return
|
||||
}
|
||||
|
||||
Object brokerData = json.parseText(new String(nodeData.data, 'UTF-8'))
|
||||
|
||||
this.brokers << new KafkaBroker(brokerData, brokerIdFromPath(nodeData.path))
|
||||
this.brokers << new KafkaBroker(brokerData, brokerId)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue