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

Bug 346595

Summary: ClassCastException in ModelContentMergerViewer
Product: [Modeling] EMFCompare Reporter: Mikaël Barbero <mikael.barbero>
Component: CoreAssignee: EMF Compare <emf.compare-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: laurent.goubet, mikael.barbero
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Mikaël Barbero CLA 2011-05-20 04:01:06 EDT
When comparing two local resources (Compare > With each other menu) and by selecting "complete resourceSet", a ClassCastException occurs when trying to save the resources after one merge operation (a simple updateAttribute).

It appears that in ModelContentMergerViewer#getContents(boolean), the input is a List<?> and not a TypedElementWrapper nor a Resource. The resource is contained in the singleton List<?>

This change works for me:

== before ==

final Resource resource;
if (input instanceof TypedElementWrapper) {
	resource = ((TypedElementWrapper)input).getObject().eResource();
} else {
	resource = (Resource)input;
}

== after ==

final Resource resource;
if (input instanceof TypedElementWrapper) {
	resource = ((TypedElementWrapper)input).getObject().eResource();
} else if (input instanceof List<?>) {
	resource = (Resource)((List<?>)input).get(0);
} else {
	resource = (Resource)input;
}
Comment 1 Laurent Goubet CLA 2011-05-20 04:14:30 EDT
This is a regression which should be fixed in RC2