DataNucleus JIRA is now in read-only mode. Raise any new issues in GitHub against the plugin that it applies to. DataNucleus JIRA will remain for the foreseeable future but will eventually be discontinued
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.

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

Andy Jefferson made changes - 20/Sep/10 04:24 PM
Field Original Value New Value
Status Open [ 1 ] Resolved [ 5 ]
Assignee Andy Jefferson [ andy ]
Fix Version/s 2.2.0.m2 [ 11022 ]
Resolution Fixed [ 1 ]
Andy Jefferson made changes - 20/Oct/10 09:29 AM
Status Resolved [ 5 ] Closed [ 6 ]
Andy Jefferson made changes - 04/Oct/12 05:02 PM
Component/s Persistence [ 10200 ]
Component/s JDO [ 10201 ]