Bug 424615 - cdoResource.delete(null) throws NPE, when resource obtained from a connection aware URI.
Summary: cdoResource.delete(null) throws NPE, when resource obtained from a connection...
Status: NEW
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 4.13   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-23 09:54 EST by Christophe Bouhier CLA
Modified: 2020-12-11 10:45 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christophe Bouhier CLA 2013-12-23 09:54:10 EST
how to reproduce: 

when loading a CDOResource with a connection aware URI on a ResourceSet and then calling delete(null) on it will throw an NPE, trying to obtain the ViewSet for the ResourceSet. 

The problem is that the ResourceSet used to load the Resource initially, 
is not the same as the ResourceSet in the transaction ViewSet. 
The transaction in this case is provided by a custom ViewProvider. 
Should it do anything special to make sure there is only one ResourceSet? 

NPE: 


java.lang.NullPointerException
	at org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl.removeFromResourceSet(CDOResourceImpl.java:1460)
	at org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl.cdoInternalPostDetach(CDOResourceImpl.java:401)
	at org.eclipse.emf.internal.cdo.view.CDOStateMachine.detach(CDOStateMachine.java:289)
	at org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl.detached(CDOResourceImpl.java:1514)
	at org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl$ContentsCDOList.inverseRemove(CDOResourceImpl.java:1773)
	at org.eclipse.emf.common.notify.impl.DelegatingNotifyingListImpl.remove(DelegatingNotifyingListImpl.java:725)
	at org.eclipse.emf.common.util.DelegatingEList.remove(DelegatingEList.java:500)
	at org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl.delete(CDOResourceImpl.java:1445)
	at org.eclipse.emf.edapt.cdo.tests.CDOMigrationTestBase.clear(CDOMigrationTestBase.java:254)
Comment 1 Christophe Bouhier CLA 2013-12-23 10:07:40 EST
Opening the transaction with the provided ResourceSet in CDOViewProvider.getView() solves the problem. 

please close.
Comment 2 Eike Stepper CLA 2015-07-14 02:13:15 EDT
Moving all open bugzillas to 4.5.
Comment 3 Eike Stepper CLA 2016-07-31 00:55:56 EDT
Moving all unaddressed bugzillas to 4.6.
Comment 4 Eike Stepper CLA 2017-12-28 01:15:33 EST
Moving all open bugs to 4.7
Comment 5 Eike Stepper CLA 2019-11-08 02:07:48 EST
Moving all unresolved issues to version 4.8-
Comment 6 Eike Stepper CLA 2019-12-13 12:45:42 EST
Moving all unresolved issues to version 4.9
Comment 7 Eike Stepper CLA 2020-12-11 10:45:51 EST
Moving to 4.13.