Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 369976

Summary: ModelUtils.merge() should validate fragments
Product: [Eclipse Project] Platform Reporter: Brian de Alwis <bsd>
Component: UIAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 4.2   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard: stalebug
Bug Depends on:    
Bug Blocks: 562497    

Description Brian de Alwis CLA 2012-01-27 12:19:57 EST
We're not protecting ourselves when merging fragments into the model.  It's possible for a fragment to store an invalid object in a feature.

Bug 369975 provides one recipe for creating such a fragment.  The resulting fragment, when loaded, causes an ArrayStoreException as it tries to store an HandlerImpl into an array of MToolBarContribution:

Daemon Thread [Thread-1] (Suspended (exception ArrayStoreException))	
	EObjectContainmentEList<E>(BasicEList<E>).assign(int, E) line: 124	
	EObjectContainmentEList<E>(BasicEList<E>).addAllUnique(int, Collection<? extends E>) line: 514	
	EObjectContainmentEList<E>(NotifyingListImpl<E>).doAddAllUnique(int, Collection<? extends E>) line: 506	
	EObjectContainmentEList<E>(NotifyingListImpl<E>).addAllUnique(int, Collection<? extends E>) line: 478	
	EObjectContainmentEList<E>(NotifyingListImpl<E>).addAllUnique(Collection<? extends E>) line: 406	
	EObjectContainmentEList<E>(AbstractEList<E>).addAll(Collection<? extends E>) line: 374	
	ModelUtils.merge(MApplicationElement, EStructuralFeature, List<MApplicationElement>, String) line: 124	
	StringModelFragmentImpl.merge(MApplication) line: 288	
	ModelAssembler.processModel() line: 164	
	ResourceHandler.loadMostRecentModel() line: 246	
	E4Application.loadApplicationModel(IApplicationContext, IEclipseContext) line: 349	
	E4Application.createE4Workbench(IApplicationContext, Display) line: 210	

Basically E4's ModelUtils.merge() should be checking that the elements being added are compatible with the feature.
Comment 1 Lars Vogel CLA 2019-11-14 03:41:54 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

If the bug is still relevant, please remove the "stalebug" whiteboard tag.