Bug 532168 - ControlledResourceTracker throws NPE upon Rollback
Summary: ControlledResourceTracker throws NPE upon Rollback
Status: UNCONFIRMED
Alias: None
Product: Papyrus
Classification: Modeling
Component: Core (show other bugs)
Version: 3.2.0   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-08 06:21 EST by Thorsten Schlathölter CLA
Modified: 2018-03-08 07:54 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 Thorsten Schlathölter CLA 2018-03-08 06:21:30 EST
The ControlledResourceTracker may throw a NPE on rollback. 

The situation is that several resources were added during a transaction. One Resource was added that contained an object (Document) which itself was contained in another container (Project) (so we have a cross resource containment here).

In this situation a rollback occured and the NPE is thrown in the below code snipped because container.eResource() is null.

- oldRoot is the Document which was removed from the resource
- container resolves to the project (which was contained in a different Resource. At the point of NPE the project has already been removed from its own resource)

protected void handleRemove(Resource resource, EObject oldRoot) {
		InternalEObject container = ((InternalEObject) oldRoot).eInternalContainer();
		if (container != null) {
			// Found cross-resource containment
			URI parentURI = container.eIsProxy() ? container.eProxyURI().trimFragment() : container.eResource().getURI();
			if (parentURI != null) {
				unmap(resource.getURI(), parentURI);
			}
		}
	}
Comment 1 Thorsten Schlathölter CLA 2018-03-08 07:54:03 EST
Just to clarify: we use papyrus with our own models which we store in the same ResourceSet. An option to "not track" our own resources would also be nice because I think there is no need for the ResourceTracker to track these resources at all.