Unregistering objects is not cleaning up the context correctly
--------------------------------------------------------------
Key: CAY-551
URL: http://issues.apache.org/cayenne/browse/CAY-551
Project: Cayenne
Type: Bug
Components: Cayenne Core Library
Versions: 1.2 [BETA]
Environment: All configurations.
Reporter: Marcin Skladaniec
This task is related a bit to already closed task CAY-547.
to reproduce:
Site site = getTheSiteFromDatabase();
Room room = (Room) context.newObject(Room.class);
room.setSite(site);
context.getGraphManager().unregisterNode(room.getObjectId());
context.commitChanges();
commiting will fail, due to Exception: "Attempt to add null target DataObject."
(Whole stack trace at the end)
Looking into context will reveal that the site is in modified state waiting for
commiting. But there was actually no change to the site, as the relationship is
(one)site -< (many)rooms, and even if there was this diff should be reverted
when unregistering the node.
I have not yet tried what would happen with many to many relationships.
Stack trace :
[java] org.objectstyle.cayenne.CayenneRuntimeException: [v.1.2B3 May 17 2006]
Remote error. URL - http://localhost:8080/test-server; CAUSE - Attempt to add
null target DataObject.
[java] at
org.objectstyle.cayenne.remote.hessian.HessianConnection.doSendMessage(HessianConnection.java:181)
[java] at
org.objectstyle.cayenne.remote.BaseConnection.sendMessage(BaseConnection.java:109)
[java] at
org.objectstyle.cayenne.remote.ClientChannel.send(ClientChannel.java:279)
[java] at
org.objectstyle.cayenne.remote.ClientChannel.onSync(ClientChannel.java:188)
[java] at
org.objectstyle.cayenne.CayenneContext.doCommitChanges(CayenneContext.java:233)
[java] at
org.objectstyle.cayenne.CayenneContext.commitChanges(CayenneContext.java:220)
[java] at cayenne3t.example.client.Main.execute(Unknown Source)
[java] at cayenne3t.example.client.Main.main(Unknown Source)
[java] Caused by: java.lang.NullPointerException: Attempt to add null
target DataObject.
[java] at
org.objectstyle.cayenne.CayenneDataObject.addToManyTarget(CayenneDataObject.java:298)
[java] at
org.objectstyle.cayenne.access.ChildDiffLoader.arcCreated(ChildDiffLoader.java:146)
[java] at
org.objectstyle.cayenne.graph.ArcCreateOperation.apply(ArcCreateOperation.java:80)
[java] at
org.objectstyle.cayenne.graph.CompoundDiff.apply(CompoundDiff.java:133)
[java] at
org.objectstyle.cayenne.access.DataContext.onContextFlush(DataContext.java:1215)
[java] at
org.objectstyle.cayenne.access.ClientServerChannel.onCommit(ClientServerChannel.java:195)
[java] at
org.objectstyle.cayenne.access.ClientServerChannel.onSync(ClientServerChannel.java:147)
[java] at
org.objectstyle.cayenne.remote.service.DispatchHelper.dispatch(DispatchHelper.java:80)
[java] at
org.objectstyle.cayenne.remote.service.BaseRemoteService.processMessage(BaseRemoteService.java:182)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:585)
[java] at
com.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:157)
[java] at
org.objectstyle.cayenne.remote.hessian.service._HessianServlet.service(_HessianServlet.java:388)
[java] at cayenne3t.example.util.StartupServlet.service(Unknown Source)
[java] at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
[java] at
org.mortbay.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:666)
[java] at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
[java] at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
[java] at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
[java] at org.mortbay.http.HttpServer.service(HttpServer.java:909)
[java] at
org.mortbay.http.HttpConnection.service(HttpConnection.java:816)
[java] at
org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:982)
[java] at
org.mortbay.http.HttpConnection.handle(HttpConnection.java:833)
[java] at
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
[java] at
org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
[java] at
org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/cayenne/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira