Little improvements on API (close #26)#27
Conversation
|
@henri-tremblay : ok for me when build will pass. Would it be possible also to add a fix so that we do not have a NPE in the case the object of the query is not in the tree ? I..e: Instead of doing: We should be able to just do something like: or: And the query system would just return an empty set of nodes because the queried objects are not there. (related to Terracotta-OSS/terracotta-platform#263) |
|
I'm ok with adding the change. One question though. Can it hide bugs? By returning an empty list instead of crashing and showing us right away that something is wrong? |
|
I don't know... I'm not sure: the query system is only used by you and me at the moment. In some case, yes it would make sense that we have for example something like: But in my case, where I just want to query the tree to find some stats, I do not care if the object is there or not, I care about if I have results or not. In my case, I will have some tests elsewhere to verify that some context objects are well put in the tree and that I can have some stat descriptors associated to them. So if I send the wrong context object, and it is not in the tree, this "bug" would be catched at another place (I won't get stats or descriptors). It's like we would need something like these perhaps ?
|
ecf3f0e to
dabc5f4
Compare
|
I think I will leave the PR as is. I had a look and the problem is that the behaviour is currently not consistant. You get a NPE when querying on descendants or children. But if you don't it returns null. So I prefer to do this change in another PR. You can file an issue. And then we will figure out a coherent behaviour. |
|
ok! |
No description provided.