Issue Details (XML | Word | Printable)

Key: NUCCORE-556
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Andy Jefferson
Reporter: Dan Checkoway
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
DataNucleus Core

PersistenceManager.getObjectsById(empty) throws

Created: 11/Aug/10 06:59 AM   Updated: 04/Oct/12 05:02 PM   Resolved: 20/Sep/10 04:24 PM
Component/s: Persistence
Affects Version/s: 2.0.4
Fix Version/s: 2.2.0.m2

Severity: Production

 Description  « Hide
If I pass an empty java.util.Collection to PersistenceManager.getObjectsById, it throws:

javax.jdo.JDOUserException: getObjectsById() does not accept null id values.

This seems totally incongruous, since JDOHelper.getObjectIds(emptyCollection) tolerates t just fine and returns an empty collection.

In other words, imho you should be able to do this:

Collection empty = new HashSet();
Collection objs = pm.getObjectsById(JDOHelper.getObjectIds(empty));

I know that seems ridiculous on the surface, but hopefully you get my gist. It sucks to have to empty-check and write special case code to handle that. Imho, pm.getObjectsById would just return an empty collection if it was passed an empty collection of OIDs.

Sort Order: Ascending order - Click to sort in descending order
Andy Jefferson added a comment - 20/Sep/10 04:24 PM
SVN trunk now returns an empty collection when the input is an empty collection. No test in the JDO TCK checks for this; maybe it ought to, but raise that with Apache JDO