Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 346595 - ClassCastException in ModelContentMergerViewer
Summary: ClassCastException in ModelContentMergerViewer
Status: CLOSED FIXED
Alias: None
Product: EMFCompare
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: EMF Compare CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-20 04:01 EDT by Mikaël Barbero CLA
Modified: 2011-05-20 04:14 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 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