Bug 547839 - ClassCastException in ModelUtils#mergeList
Summary: ClassCastException in ModelUtils#mergeList
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.6   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 562497
  Show dependency tree
 
Reported: 2019-06-01 16:45 EDT by Rolf Theunissen CLA
Modified: 2020-04-26 13:15 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rolf Theunissen CLA 2019-06-01 16:45:28 EDT
Created separate bug for Bug 487748 comment 3


I found another issue with the ModelUtils#mergeList method. In the last else branch labelled "replace" it uses the UsageCrossReferencer#find to find references to the replaced object. The list of settings returned by the UsageCrossReferencer may contain a Setting that is actually a list. Calling Setting#set on a list results in a class cast exception.

See also attached debugger screenshots.

java.lang.ClassCastException: org.eclipse.e4.ui.model.application.commands.impl.BindingContextImpl cannot be cast to java.util.List
	at org.eclipse.emf.ecore.util.EcoreEList.set(EcoreEList.java:457)
	at org.eclipse.e4.ui.model.internal.ModelUtils.mergeList(ModelUtils.java:189)
	at org.eclipse.e4.ui.model.internal.ModelUtils.merge(ModelUtils.java:145)
	at org.eclipse.e4.ui.model.fragment.impl.StringModelFragmentImpl.mergeIdList(StringModelFragmentImpl.java:322)
	at org.eclipse.e4.ui.model.fragment.impl.StringModelFragmentImpl.merge(StringModelFragmentImpl.java:300)
	at org.eclipse.e4.ui.internal.workbench.ModelAssembler.processModelFragment(ModelAssembler.java:272)
	at org.eclipse.e4.ui.internal.workbench.ModelAssembler.processFragmentConfigurationElement(ModelAssembler.java:162)
	at org.eclipse.e4.ui.internal.workbench.ModelAssembler.processFragments(ModelAssembler.java:118)
	at org.eclipse.e4.ui.internal.workbench.ModelAssembler.processModel(ModelAssembler.java:96)
	at org.eclipse.e4.ui.internal.workbench.ResourceHandler.loadMostRecentModel(ResourceHandler.java:197)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application.loadApplicationModel(E4Application.java:377)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:252)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:632)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:610)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
	at esa.open.application.Application.start(Application.java:55)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1519)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1492)