Hello,

While implementing JCR using Jackrabbit jcr commun module I bumped in some error in tests.
Specialy those on node types like this one :

public void testEmptyNodeTypeTemplate() throws Exception {

       NodeTypeTemplate ntt = ntm.createNodeTypeTemplate();
       assertNull(ntt.getPrimaryItemName());

       assertNull(ntt.getDeclaredChildNodeDefinitions());
       assertNull(ntt.getDeclaredPropertyDefinitions());
   }

The problem here is we are often recommanded to Not return null when and empty array would be better. The above test assume that we store a potentiel null array in the node type template and that it may be null. For exemple I have implemented it with a Collection object and indirectly it never return null.

So rather than fixing my code to use an array and raise the risk of null pointer exceptions a bit everywhere. I am wondering it is not the test which is making a dangerous assumption here.

Or is it said in JCR that the result must be null rather than an empty array ?

johann sorel

Reply via email to