Message:
A new issue has been created in JIRA.
---------------------------------------------------------------------
View the issue:
http://objectstyle.org/jira/secure/ViewIssue.jspa?key=CAY-343
Here is an overview of the issue:
---------------------------------------------------------------------
Key: CAY-343
Summary: ObjectStore.unregisterNewObjects() should not throw null pointer exception
Type: Improvement
Status: Assigned
Priority: Major
Project: Cayenne
Components:
Cayenne Core Library
Versions:
1.2 [DEV]
Assignee: Andrus Adamchik
Reporter: jay dwyer
Created: Fri, 8 Jul 2005 10:34 PM
Updated: Fri, 8 Jul 2005 10:34 PM
Environment: all
Description:
i've discovered that ObjectStore.unregisterNewObjects() will throw an undocumented null pointer if there are no new objects in the data store, as the first line in the method attemts to get an iterator from the newObjectMap, which may not be initialised if no new objects have been created yet.
a simple check for null and just return wouldnt affect the contract of the method as far as i can tell, otherwise a helper ObjectStore.hasNewObjects() method might be helpful to avoid potential problems.
my use case for this is in a web application, after the controller recieves the details for a new object, it calls on the delegate to set it (and others) up with the given parameters, then commit. if the commit fails, i want to roll back any other changes, and remove the new object from the object store.
this works fine if the new object is already in there, but if the error occurs higher up in the chain, i want to safely call rollback and unregister without the null pointer ;)
am i perhaps going about this the wrong way?
all comments welcome.
jd
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://objectstyle.org/jira/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
This archive was generated by hypermail 2.0.0 : Fri Jul 08 2005 - 22:34:36 EDT