Community
Participate
Working Groups
Cloned from: 322754: NullPointerException after deleting a resource https://bugs.eclipse.org/bugs/show_bug.cgi?id=322754 When trying to upgrade to CDO 3, I have run into a NullPointerException after deleting a resource (stack trace below). The delete is done by resource.delete(null); When commiting this change I get the exception. The variable "view" is null when the exception occurs. This exception never happened with CDO 2. java.lang.NullPointerException at org.eclipse.emf.internal.cdo.util.FSMUtil.adapt(FSMUtil.java:108) at org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl.getURIFragment(CDOResourceImpl.java:557) at org.eclipse.emf.ecore.util.EcoreUtil.getURI(EcoreUtil.java:2901) at org.eclipse.emf.internal.cdo.view.CDOViewImpl.provideCDOID(CDOViewImpl.java:1196) at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.provideCDOID(CDOTransactionImpl.java:1788) at org.eclipse.emf.cdo.internal.common.revision.delta.CDOSingleValueFeatureDeltaImpl.writeValue(CDOSingleValueFeatureDeltaImpl.java:86) at org.eclipse.emf.cdo.internal.common.revision.delta.CDOSingleValueFeatureDeltaImpl.write(CDOSingleValueFeatureDeltaImpl.java:62) at org.eclipse.emf.cdo.internal.common.protocol.CDODataOutputImpl.writeCDOFeatureDelta(CDODataOutputImpl.java:385) at org.eclipse.emf.cdo.internal.common.revision.delta.CDORevisionDeltaImpl.write(CDORevisionDeltaImpl.java:158) at org.eclipse.emf.cdo.internal.common.protocol.CDODataOutputImpl.writeCDORevisionDelta(CDODataOutputImpl.java:380) at org.eclipse.emf.cdo.internal.net4j.protocol.CommitTransactionRequest.requestingCommit(CommitTransactionRequest.java:190) at org.eclipse.emf.cdo.internal.net4j.protocol.CommitTransactionRequest.requesting(CommitTransactionRequest.java:141) at org.eclipse.emf.cdo.internal.net4j.protocol.CommitTransactionRequest.requesting(CommitTransactionRequest.java:116) at org.eclipse.net4j.signal.RequestWithMonitoring.requesting(RequestWithMonitoring.java:163) at org.eclipse.net4j.signal.RequestWithConfirmation.doExtendedOutput(RequestWithConfirmation.java:117) at org.eclipse.net4j.signal.Signal.doOutput(Signal.java:285) at org.eclipse.net4j.signal.RequestWithConfirmation.doExecute(RequestWithConfirmation.java:102) at org.eclipse.net4j.signal.RequestWithMonitoring.doExecute(RequestWithMonitoring.java:233) at org.eclipse.net4j.signal.SignalActor.execute(SignalActor.java:66) at org.eclipse.net4j.signal.Signal.runSync(Signal.java:240) at org.eclipse.net4j.signal.SignalProtocol.startSignal(SignalProtocol.java:462) at org.eclipse.net4j.signal.RequestWithConfirmation.doSend(RequestWithConfirmation.java:87) at org.eclipse.net4j.signal.RequestWithConfirmation.send(RequestWithConfirmation.java:73) at org.eclipse.net4j.signal.RequestWithMonitoring.send(RequestWithMonitoring.java:108) at org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientProtocol.send(CDOClientProtocol.java:375) at org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientProtocol.commitTransaction(CDOClientProtocol.java:258) at org.eclipse.emf.internal.cdo.transaction.CDOSingleTransactionStrategyImpl.commit(CDOSingleTransactionStrategyImpl.java:73) at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.commit(CDOTransactionImpl.java:906)
Added Bugzilla_322754_Test Committed to HEAD
Eike, any idea if this can be solved easily?
Finally I found out what seems to happen: You're deleting a resource but are still having some resources with objects that point to objects in the deleted resource. Please compare Bugzilla_322754_Test.testResourceDeleteWithDanglingReferences(). I'll attach a patch that makes this situation more obvious by throwing a DanglingReferenceException. The exception message (object is not contained in a resource" is not 100% correct, as the object is contained by a resource, but both the resource and the object are TRANSIENT.
Created attachment 182097 [details] Patch v1
Committed to HEAD. Please reopen if you think I've misunderstood or if you are able to propose a better solution.
Available in R20110608-1407