Skip to content

Commit

Permalink
minor: NodelClients.list() should return empty array on lookup miss i…
Browse files Browse the repository at this point in the history
…nstead of throwing NullPointer exception.
  • Loading branch information
justparking committed Apr 11, 2017
1 parent 22f97a1 commit 659aca0
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -888,10 +888,12 @@ protected List<NodeURL> getAllNodesURLs() throws IOException {
*/
protected List<NodeURL> getNodeURLs(SimpleName name) throws IOException {
Collection<AdvertisementInfo> list;
if (name == null)
if (name == null) {
list = AutoDNS.instance().list();
else
list = Arrays.asList(AutoDNS.instance().resolve(name));
} else {
AdvertisementInfo result = AutoDNS.instance().resolve(name);
list = result != null ? Arrays.asList(result) : Collections.<AdvertisementInfo>emptyList();
}

List<NodeURL> nodeURLs = new ArrayList<NodeURL>();

Expand Down

0 comments on commit 659aca0

Please sign in to comment.