jbossas/jboss-as — pull request #3398 by pieterbos (2012-11-05 10:37:39+00:00)
Title: AS7-5761 EJB2 entity bean CMP collection toArray throws NPE

This fixes the NullPointerException and implements the desired behaviour, including a test case.

This should be equally efficient as the iterator applied over all elements. I do not know if there is a more efficient way to get the whole array of entity objects, as I do not know the details of CMP queries and caching implementation. If there is, this patch can be improved. But at least it works now and no longer throws Exceptions.

This commit can also directly be applied to the 7.1 branch. I can create a separate pull request for that if required.