Bug 369976 - ModelUtils.merge() should validate fragments
Summary: ModelUtils.merge() should validate fragments
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks: 562497
  Show dependency tree
 
Reported: 2012-01-27 12:19 EST by Brian de Alwis CLA
Modified: 2020-04-26 13:15 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.